Arkadiy Vertleyb wrote:
> If I understand correctly, with your approach:
>
> (a, b, null) == (a, b, c1), and
> (a, b, null) == (a, b, c2), but
> (a, b, c1) != (a, b, c2)
>
> If this is correct, I am afraid that whether or not such a predicate
> works correctly may depend on a particular implementation of
> std::set...?
It shouldn't. Once you define the strict weak ordering, set's behavior is well
defined. The compare function would look like this:
// Returns true iff first element is less than second.
struct Compare {
bool operator()(Key const& t1, Key const& t2) {
for n = 1 to number of fields:
if nth field in t1 == null or nth field in t2 == null:
return false
if nth field in t1 < nth field in t2:
return true
return false
}
};
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost