Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2005-11-25 12:14:52


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

test_tuple_tricky.cpp
c:\data\boost\develop\boost\boost\spirit\fusion\sequence\detail\sequence_not_equal_to.hpp(25)
: error C2784: 'disable_if<boost::fusion::is_sequence<Seq1>,bool>::type
boost::fusion::operator !=(const Seq1 &,const
boost::fusion::sequence_base<Seq2> &)' : could not deduce template argument
for 'const boost::fusion::sequence_base<T2> &' from 'const
boost::add_const<T>::type'
with
[
T=boost::mpl::v_at<boost::fusion::tuple_data2<strict_comparison1,strict_comparison2>::types,0>::type
]
c:\data\boost\develop\boost\boost\spirit\fusion\sequence\not_equal_to.hpp(46)
: see declaration of 'boost::fusion::operator`!=''
c:\data\boost\develop\boost\boost\spirit\fusion\sequence\detail\sequence_not_equal_to.hpp(54)
: see reference to function template instantiation 'bool
boost::fusion::detail::sequence_not_equal_to_detail::call<boost::fusion::detail::sequence_not_equal_to<Seq1,Seq2>,I1,I2>(const
T &,const I1 &,const I2 &)' being compiled
with
[
Seq1=const boost::fusion::tuple2<strict_comparison1,strict_comparison2>,
Seq2=const boost::fusion::tuple2<strict_comparison1,strict_comparison2>,
I1=boost::fusion::meta::begin<const
boost::fusion::tuple2<strict_comparison1,strict_comparison2>>::type,
I2=boost::fusion::meta::begin<const
boost::fusion::tuple2<strict_comparison1,strict_comparison2>>::type,
T=boost::fusion::detail::sequence_not_equal_to<const
boost::fusion::tuple2<strict_comparison1,strict_comparison2>,const
boost::fusion::tuple2<strict_comparison1,strict_comparison2>>
]
c:\data\boost\develop\boost\boost\spirit\fusion\sequence\detail\sequence_not_equal_to.hpp(39)
: see reference to function template instantiation 'bool
boost::fusion::detail::sequence_not_equal_to<Seq1,Seq2>::call<I1,I2>(const
I1 &,const I2 &,boost::mpl::false_)' being compiled
with
[
Seq1=const boost::fusion::tuple2<strict_comparison1,strict_comparison2>,
Seq2=const boost::fusion::tuple2<strict_comparison1,strict_comparison2>,
I1=boost::fusion::meta::begin<const
boost::fusion::tuple2<strict_comparison1,strict_comparison2>>::type,
I2=boost::fusion::meta::begin<const
boost::fusion::tuple2<strict_comparison1,strict_comparison2>>::type
]
c:\data\boost\develop\boost\boost\spirit\fusion\sequence\not_equal_to.hpp(32)
: see reference to function template instantiation 'bool
boost::fusion::detail::sequence_not_equal_to<Seq1,Seq2>::call<boost::fusion::meta::begin<Sequence>::type,boost::fusion::meta::begin<Sequence>::type>(const
I1 &,const I2 &)' being compiled
with
[
Seq1=const boost::fusion::tuple2<strict_comparison1,strict_comparison2>,
Seq2=const boost::fusion::tuple2<strict_comparison1,strict_comparison2>,
Sequence=const boost::fusion::tuple2<strict_comparison1,strict_comparison2>,
I1=boost::fusion::meta::begin<const
boost::fusion::tuple2<strict_comparison1,strict_comparison2>>::type,
I2=boost::fusion::meta::begin<const
boost::fusion::tuple2<strict_comparison1,strict_comparison2>>::type
]
c:\data\boost\develop\boost\libs\tr1\test\test_tuple_tricky.cpp(93) : see
reference to function template instantiation 'bool boost::fusion::operator
!=<boost::fusion::tuple2<T0,T1>,boost::fusion::tuple2<T0,T1>>(const
boost::fusion::sequence_base<Sequence> &,const
boost::fusion::sequence_base<Sequence> &)' being compiled
with
[
T0=strict_comparison1,
T1=strict_comparison2,
Sequence=boost::fusion::tuple2<strict_comparison1,strict_comparison2>
]
c:\data\boost\develop\boost\boost\spirit\fusion\sequence\detail\sequence_not_equal_to.hpp

And then many more like that.

Any ideas?

Note I haven't got around to attemping mixed sequence comparisons yet, so
comparing

tuple<strict_compare1, strict_compare2> and tuple<strict_compare2,
strict_compare1>

should also work OK, and again only invoke operators == and <.

Regards, John.


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