Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-02-19 13:37:50


"Fernando Cacciola" <fernando_cacciola_at_[hidden]> writes:

> "David Abrahams" <dave_at_[hidden]> wrote in message
> news:usmuk890r.fsf_at_boost-consulting.com...
>> "Fernando Cacciola" <fernando_cacciola_at_[hidden]> writes:
>>
>> > Any idea about what to do with reference to reference problem?
>>
>> What's the problem?
>>
> Currently, optional<Y> has:
>
> explicit optional ( T const& val )
> T* get();
> T* operator->() ;
> T& operator *();
>
> those are all illegal if T is a reference type.

    explicit optional ( typename add_reference<typename add_const<T>::type>::type val )
    typename add_pointer<typename remove_reference<T>::type>::type get();
    typename add_pointer<typename remove_reference<T>::type>::type operator->() ;
    typename add_reference<T>::type operator *();

>> >
>> > What was the idea of: optional< exactly<T&> > ?
>>
>> It's an ambiguity breaker: a way of specifying, when constructed with
>> a variant<T,T&>, that you want to get the T& and not the T.
>>
> hmmm, shouldn't 'exactly' appear along with extract then?
> What's the meaning of "optional< exactly<T&> > " by itself, without
> variant<T,T&> in the scene?

I dunno, maybe nothing; we were talking about optional as a
replacement for extract.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk