[typeof] deducing type at class level

Hello all, Is there any way to use BOOST_TYPEOF at class level? For example: struct vect { size_t size(); typedef BOOST_TYPEOF(size()) size_type; // can I make this work somehow? }; If not with Boost.Typeof, can I do this with C++0x? Thanks! --Lorenzo -- View this message in context: http://boost.2283326.n4.nabble.com/boost-typeof-deducing-type-at-class-level... Sent from the Boost - Dev mailing list archive at Nabble.com.

On 22/06/2011 18:02, lcaminiti wrote:
typedef BOOST_TYPEOF(make<vect>().size()) size_type; with #ifndef BOOST_NO_RVALUE_REFERENCES template<class T> typename enable_if< is_reference<T>, T
::type make();
template<class T> typename disable_if< is_reference<T>, T&
::type make();
#else T&& make(); #endif

Mathias Gaunard-2 wrote:
Hi, note that there is already declval in the standard ans in Boost.Utility taht can be used instead of make. 20.2.4 Function template declval [declval] 1 The library provides the function template declval to simplify the definition of expressions which occur as unevaluated operands (Clause 5). Best, Vicente -- View this message in context: http://boost.2283326.n4.nabble.com/boost-typeof-deducing-type-at-class-level... Sent from the Boost - Dev mailing list archive at Nabble.com.
participants (7)
-
Jeffrey Lee Hellrung, Jr.
-
Jeroen Habraken
-
lcaminiti
-
Lorenzo Caminiti
-
Mathias Gaunard
-
Steven Watanabe
-
Vicente Botet