|
Boost : |
Subject: Re: [boost] [typeof] deducing type at class level
From: Lorenzo Caminiti (lorcaminiti_at_[hidden])
Date: 2011-06-22 21:08:00
On Wed, Jun 22, 2011 at 4:08 PM, Steven Watanabe <watanabesj_at_[hidden]> wrote:
> AMDG
>
> On 06/22/2011 12:40 PM, Jeffrey Lee Hellrung, Jr. wrote:
>> On Wed, Jun 22, 2011 at 10:00 AM, Mathias Gaunard <
>> mathias.gaunard_at_[hidden]> wrote:
>>
>>> On 22/06/2011 18:42, Jeroen Habraken wrote:
>>>
>>> This can be done using boost::type_traits::add_**reference I believe:
>>>>
>>>> template<class T>
>>>> typename add_reference<T>::type make();
>>>>
>>>
>>> Actually there is a declval somewhere in boost that more or less does this,
>>> unfortunately it returns by value in C++03, which is a big no-no for me,
>>> since it restricts it to copyable types.
>>>
>>
>> [At the risk of drifting off-topic...] If you're worried about that,
>> shouldn't you be using declval<T&>() if you really want an lvalue?
>>
>
> Yeah. Returning by value is the only way
> to get an rvalue in C++03.
>
> In Christ,
> Steven Watanabe
Thanks to all. What you have suggested works for me (I'm not worried
about r/lvalues).
--Lorenzo
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk