
On 7/11/06, Philippe Vaucher <philippe.vaucher@gmail.com> wrote:
We could maybe also do some template / macro fun to help them to define those ? Something like :
#define DEF_OP_MIN(cont) bool cont::operator<(const cont& a, const cont&b) { return &a < &b; }
That's not a valid way to define a operator< that can be used to store objects in an associative container. It is (implicitly?) expected that if an object is copied constructed from another object, the original object and the copied object will have the same total ordering. I justify this statement by the fact that containers are required to have linear complexity for copy construction, which implies the elements have to be copy constructed and maintain the same order as the original elements. Kevin Spinar