Boost logo

Boost :

From: Jaakko Jarvi (jarvi_at_[hidden])
Date: 2005-11-28 11:47:00


On Nov 25, 2005, at 11:14 AM, John Maddock wrote:

>> AFAICT, none that'll affect the TR1 interface. In fact, the
>> TR1 module is just a thin wrapper in V2, perhaps it can be used
>> as is?
>
> There appear to be other problems with the comparison operators,
> these are
> required to use only operators == and < on the types held by the
> tuple, but
> given:
>
> struct strict_comparison1{};
> struct strict_comparison2{};
> bool operator==(const strict_comparison1&, const strict_comparison1&);
> bool operator<(const strict_comparison1&, const strict_comparison1&);
> bool operator==(const strict_comparison2&, const strict_comparison2&);
> bool operator<(const strict_comparison2&, const strict_comparison2&);
> bool operator==(const strict_comparison1&, const strict_comparison2&);
> bool operator<(const strict_comparison1&, const strict_comparison2&);
> bool operator==(const strict_comparison2&, const strict_comparison1&);
> bool operator<(const strict_comparison2&, const strict_comparison1&);
>
> Then trying to instantiate the operators with:
>
> // strict comparisons:
> const std::tr1::tuple<strict_comparison1, strict_comparison2>
> comp1, comp2;
> verify_return_type(comp1 == comp2, false);
> verify_return_type(comp1 != comp2, false);
> verify_return_type(comp1 < comp2, false);
> verify_return_type(comp1 > comp2, false);
> verify_return_type(comp1 <= comp2, false);
> verify_return_type(comp1 >= comp2, false);
>
> Fails with some extremely criptic error messages in operator!=
>

The specification of tuples was changed in the committee from the
original proposal along the way.
In particular, comparison operators were changed and the
implementation in Fusion reflects the old
specs. According to the old implementation, each operator only relied
on the same elementwise operator.
E.g. != was defined in terms of != between the elements, >= only used
>= between the elements etc.
So I think == and < should stay as they are now, but
the definition of !=, <=, >= and > should be changed to be defined in
terms of == and < for tuples.

Best, Jaakko


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk