$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] [typeof] deducing type at class level
From: Vicente Botet (vicente.botet_at_[hidden])
Date: 2011-06-22 13:04:02
Mathias Gaunard-2 wrote:
> 
> On 22/06/2011 18:02, lcaminiti wrote:
>> 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?
> 
> 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
> 
> 
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-tp3617432p3617591.html Sent from the Boost - Dev mailing list archive at Nabble.com.