Boost logo

Boost :

From: Joel de Guzman (djowel_at_[hidden])
Date: 2003-09-01 00:32:30


Brian McNamara <lorgon_at_[hidden]> wrote:
> On Sun, Aug 31, 2003 at 09:12:59PM -0600, Dave Gomboc wrote:
>>> The point is that optional<T> is not a T, and most notably, a template
>>> function will never perform the coercion. Replace the lines like
>>> B b = get<2>(args);
>>> in your example with real calls to, e.g.
>>> do_something( get<2>(args) )
>>> and do_something() is likely to fail if it's a template function
>>> (expecting a T and not an optional<T>).
>>
>> Okay, you've demonstrated that it may not be possible to drop-in
>> optional<T> for T with zero code changes when T is not a scalar type.
>> (Usually, my Ts are! ;-) Nonetheless, it is at least still possible to
>> write generic code that accepts either T or the wrapped T, which is
>> definitely an improvement over writing a whack of special-casing code.

Darn! Can't we just overload operator.() <operator-dot> ?????
<ahem><ahem><cough><cough><cough> ;-)

I want my proxies!

-- 
Joel de Guzman
http://www.boost-consulting.com
http://spirit.sf.net

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