|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2005-07-15 13:01:16
Andrey Melnikov <melnikov_at_[hidden]> writes:
> Rob Stewart wrote:
>> From: "Jost, Andrew" <Andrew_Jost_at_[hidden]>
>>
>>>But you're assuming that we have control over the library. That's
>>>probably the exception rather than the rule in real life.
>>
>> If you can change the library to use an adaptor for an optional,
>> why can't you change the library to use the optional directly?
>>
>
> Adapters work outside the library and don't require any changes to the
> library. Library requires underlying values, and with the adapter it
> gets them automagically. The library doesn't know anything about
> Optional and adapters, library clients do.
FYI, I might tend to use a dual_state object that either yields a
contained _reference_ or the result of invoking a function, because
you usually don't want to pay for copy construction of a contained
object if you don't have to, and it feels nonuniform to have
lightweight copy only when the default is going to be used.
-- 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