Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-03-25 12:57:04


"Edward Diener" <eddielee_at_[hidden]> writes:

> David Abrahams wrote:
>> Douglas Paul Gregor <gregod_at_[hidden]> writes:
>>
>>> On Mon, 24 Mar 2003, Edward Diener wrote:
>>>
>>>> Do you really want the key to an associative container to be an
>>>> optional value ? I would be hard-pressed to find a use for that.
>>>
>>> FWIW, the Signals library actually does this internally (although
>>> with boost::any objects instead of boost::optional objects).
>>> However, I would contend that the need is too specialized to warrant
>>> adding an operator<.
>>
>> Seems entirely reasonable to me to add it. It looks like at least two
>> people have needed exactly those semantics. What's the cost?
>
> I am not trying to shoot down the request but could someone give me a
> practical example of the case where an optional value which does not exist
> ( I hope that's the right term for when an optional value has no valid
> value ) serves as a key in an associative container ?

I guess you can look at how boost::any is used in the signals library
for an example.

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