Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-08-29 15:02:36


Mat Marcus <mmarcus_at_[hidden]> writes:

>> Well, that's a slightly different issue and you may be right. On the
>> other hand, you can always define a type which implements those
>> implicit constructors:
>>
>> template <class T>
>> struct implicit_optional : optional<T>
>> {
>> implicit_optional() {}
>> implicit_optional(optional<T> const& x) : optional<T>(x) {}
>> implicit_optional(T const& x) : optional<T>(x) {}
>> };
>>
>> You could use that in your interfaces.
>
> And then slice it back to option internally to avoid bool weirdness?

I didn't have that in mind, no. Why slice when you can avoid a copy
instead? and what is "bool weirdness"?

> Might work out. Got any good ideas to help use optional with tie?

Seems to me you could use a similar shim, as long as it had a const
assignment operator:

           tie(shim(foo), shim(bar)) = ... ;

Not very generic, but it should work out.
  

-- 
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