|
Boost : |
From: Daryle Walker (darylew_at_[hidden])
Date: 2006-07-18 18:26:53
On 7/11/06 8:37 AM, "Philippe Vaucher" <philippe.vaucher_at_[hidden]> wrote:
>> How do you make a std::set of structs, pairs, or tuples?
>>
>
> Maybe it was already said (didn't read the whole thread), but I thought I'd
> add my 0.02$.
>
> I think we should not define meaningless operator< for the structs/whatever,
> and let the user define one if he wants to use those structs in a set.
>
> We could maybe also do some template / macro fun to help them to define
> those ? Something like :
[TRUNCATE the problematic example macro/function]
If the user has to define his/her own criteria, why can't they just
encapsulate it in a custom class they use with a set? They don't have to
define it as operator "<", which could have longer-reaching consequences.
You do waste keystrokes, but there's no difference computationally (besides
avoiding the ADL issues that operator "<" could bring).
-- Daryle Walker Mac, Internet, and Video Game Junkie darylew AT hotmail DOT com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk