Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-08-31 14:16:15


"Peter Dimov" <pdimov_at_[hidden]> writes:

> David Abrahams wrote:
>> "Eric Friedman" <ebf_at_[hidden]> writes:
>>
>>> Ultimately, I do not believe any ordering scheme will provide
>>> meaningful, straightforward semantics. Assuming I am correct, I
>>> propose that the variant library offer your ordering scheme -- but
>>> only as an explicit comparison function, calling it variant_less.
>>> This would allow, for instance:
>>>
>>> std::set< my_variant, boost::variant_less<my_variant> >
>>>
>>> I'd appreciate feedback.
>>
>> I had the same thought myself, though I'd be inclined to spend a
>> little time searching for a better name than "less", since it doesn't
>> really mean that. Maybe "variant_before", using type_info::before as
>> a precedent?
>
> If you want a second opinion, I'm in the "just provide operator== and
> operator<" camp.

But, IIUC, if operator< is not provided, you'd oppose a std::less
specialization, right?

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