Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2005-11-29 05:26:57


> Joel asked me to have a look at the fusion1 TR1 stuff.
> I've had a go at the support for pairs in
> tuple_element, tuple_size, and get. I've just modified
> the operators based on the comments above as well.
> I've updated some of the fusion tests, but I've not
> had chance to run your TR1 test material yet. My tests
> were compiled against mingw gcc, and all was ok.
>
> Anyway, hope this is helpful, let me know if there are
> any (other) problems.

There are still lots of issue with the comparison operators:

The first error occurs in the < comparison, which ends up calling operator >
in sequence_less.hpp:

namespace sequence_less_detail {
template <typename T,typename I1, typename I2>
bool call(T const& self,I1 const& a, I2 const& b) {
return *a < *b
|| !(*b > *a)
&& T::call(fusion::next(a), fusion::next(b));
}
}

The thing is that's not a "less than" relation to begin with!

It's called from sequence_less::call which constructs a comparison object of
type equal_to, which looks rather suspicious to me!

I'm attaching the error messages below, but I think you're going to have to
work with the test cases I sent you, *and* devise some runtime tests to
ensure that these operators actually do what they're supposed to.

Thanks for persuing this,

John.

c:\data\boost\develop\boost\boost\spirit\fusion\sequence\detail\sequence_less.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\greater.hpp(46) :
see declaration of 'boost::fusion::operator`>''
c:\data\boost\develop\boost\boost\spirit\fusion\sequence\detail\sequence_less.hpp(56)
: see reference to function template instantiation 'bool
boost::fusion::detail::sequence_less_detail::call<boost::fusion::detail::sequence_less<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_less<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_less.hpp(41)
: see reference to function template instantiation 'bool
boost::fusion::detail::sequence_less<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\less.hpp(32) : see
reference to function template instantiation 'bool
boost::fusion::detail::sequence_less<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(102) : 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_less.hpp(25)
: error C2784: 'disable_if<boost::fusion::is_sequence<Seq2>,bool>::type
boost::fusion::operator >(const boost::fusion::sequence_base<Seq1> &,const
Seq2 &)' : could not deduce template argument for 'const
boost::fusion::sequence_base<Sequence> &' 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\greater.hpp(39) :
see declaration of 'boost::fusion::operator`>''
c:\data\boost\develop\boost\boost\spirit\fusion\sequence\detail\sequence_less.hpp(25)
: error C2784: 'bool boost::fusion::operator >(const
boost::fusion::sequence_base<Seq1> &,const
boost::fusion::sequence_base<Seq2> &)' : could not deduce template argument
for 'const boost::fusion::sequence_base<Sequence> &' 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\greater.hpp(26) :
see declaration of 'boost::fusion::operator`>''
c:\data\boost\develop\boost\boost\spirit\fusion\sequence\detail\sequence_less.hpp(25)
: error C2676: binary '>' : 'const boost::add_const<T>::type' does not
define this operator or a conversion to a type acceptable to the predefined
operator
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\detail\sequence_less.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\greater.hpp(46) :
see declaration of 'boost::fusion::operator`>''
c:\data\boost\develop\boost\boost\spirit\fusion\sequence\detail\sequence_less.hpp(56)
: see reference to function template instantiation 'bool
boost::fusion::detail::sequence_less_detail::call<boost::fusion::detail::sequence_less<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_comparison2,strict_comparison1>,
I1=boost::fusion::meta::begin<const
boost::fusion::tuple2<strict_comparison1,strict_comparison2>>::type,
I2=boost::fusion::meta::begin<const
boost::fusion::tuple2<strict_comparison2,strict_comparison1>>::type,
T=boost::fusion::detail::sequence_less<const
boost::fusion::tuple2<strict_comparison1,strict_comparison2>,const
boost::fusion::tuple2<strict_comparison2,strict_comparison1>>
]
c:\data\boost\develop\boost\boost\spirit\fusion\sequence\detail\sequence_less.hpp(41)
: see reference to function template instantiation 'bool
boost::fusion::detail::sequence_less<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_comparison2,strict_comparison1>,
I1=boost::fusion::meta::begin<const
boost::fusion::tuple2<strict_comparison1,strict_comparison2>>::type,
I2=boost::fusion::meta::begin<const
boost::fusion::tuple2<strict_comparison2,strict_comparison1>>::type
]
c:\data\boost\develop\boost\boost\spirit\fusion\sequence\less.hpp(32) : see
reference to function template instantiation 'bool
boost::fusion::detail::sequence_less<Seq1,Seq2>::call<boost::fusion::meta::begin<Sequence>::type,boost::fusion::meta::begin<const
boost::fusion::tuple2<T0,T1>>::type>(const I1 &,const I2 &)' being compiled
with
[
Seq1=const boost::fusion::tuple2<strict_comparison1,strict_comparison2>,
Seq2=const boost::fusion::tuple2<strict_comparison2,strict_comparison1>,
Sequence=const boost::fusion::tuple2<strict_comparison1,strict_comparison2>,
T0=strict_comparison2,
T1=strict_comparison1,
I1=boost::fusion::meta::begin<const
boost::fusion::tuple2<strict_comparison1,strict_comparison2>>::type,
I2=boost::fusion::meta::begin<const
boost::fusion::tuple2<strict_comparison2,strict_comparison1>>::type
]
c:\data\boost\develop\boost\libs\tr1\test\test_tuple_tricky.cpp(110) : see
reference to function template instantiation 'bool boost::fusion::operator
<<boost::fusion::tuple2<T0,T1>,boost::fusion::tuple2<strict_comparison2,strict_comparison1>>(const
boost::fusion::sequence_base<Sequence> &,const
boost::fusion::sequence_base<boost::fusion::tuple2<strict_comparison2,strict_comparison1>>
&)' 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_less.hpp(25)
: error C2784: 'disable_if<boost::fusion::is_sequence<Seq2>,bool>::type
boost::fusion::operator >(const boost::fusion::sequence_base<Seq1> &,const
Seq2 &)' : could not deduce template argument for 'const
boost::fusion::sequence_base<Sequence> &' from 'const
boost::add_const<T>::type'
with
[
T=boost::mpl::v_at<boost::fusion::tuple_data2<strict_comparison2,strict_comparison1>::types,0>::type
]
c:\data\boost\develop\boost\boost\spirit\fusion\sequence\greater.hpp(39) :
see declaration of 'boost::fusion::operator`>''
c:\data\boost\develop\boost\boost\spirit\fusion\sequence\detail\sequence_less.hpp(25)
: error C2784: 'bool boost::fusion::operator >(const
boost::fusion::sequence_base<Seq1> &,const
boost::fusion::sequence_base<Seq2> &)' : could not deduce template argument
for 'const boost::fusion::sequence_base<Sequence> &' from 'const
boost::add_const<T>::type'
with
[
T=boost::mpl::v_at<boost::fusion::tuple_data2<strict_comparison2,strict_comparison1>::types,0>::type
]
c:\data\boost\develop\boost\boost\spirit\fusion\sequence\greater.hpp(26) :
see declaration of 'boost::fusion::operator`>''
c:\data\boost\develop\boost\boost\spirit\fusion\sequence\detail\sequence_less.hpp(25)
: error C2676: binary '>' : 'const boost::add_const<T>::type' does not
define this operator or a conversion to a type acceptable to the predefined
operator
with
[
T=boost::mpl::v_at<boost::fusion::tuple_data2<strict_comparison2,strict_comparison1>::types,0>::type
]
c:\data\boost\develop\boost\boost\spirit\fusion\sequence\detail\sequence_less.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_comparison2,strict_comparison1>::types,0>::type
]
c:\data\boost\develop\boost\boost\spirit\fusion\sequence\greater.hpp(46) :
see declaration of 'boost::fusion::operator`>''
c:\data\boost\develop\boost\boost\spirit\fusion\sequence\detail\sequence_less.hpp(56)
: see reference to function template instantiation 'bool
boost::fusion::detail::sequence_less_detail::call<boost::fusion::detail::sequence_less<Seq1,Seq2>,I1,I2>(const
T &,const I1 &,const I2 &)' being compiled
with
[
Seq1=const boost::fusion::tuple2<strict_comparison2,strict_comparison1>,
Seq2=const boost::fusion::tuple2<strict_comparison1,strict_comparison2>,
I1=boost::fusion::meta::begin<const
boost::fusion::tuple2<strict_comparison2,strict_comparison1>>::type,
I2=boost::fusion::meta::begin<const
boost::fusion::tuple2<strict_comparison1,strict_comparison2>>::type,
T=boost::fusion::detail::sequence_less<const
boost::fusion::tuple2<strict_comparison2,strict_comparison1>,const
boost::fusion::tuple2<strict_comparison1,strict_comparison2>>
]
c:\data\boost\develop\boost\boost\spirit\fusion\sequence\detail\sequence_less.hpp(41)
: see reference to function template instantiation 'bool
boost::fusion::detail::sequence_less<Seq1,Seq2>::call<I1,I2>(const I1
&,const I2 &,boost::mpl::false_)' being compiled
with
[
Seq1=const boost::fusion::tuple2<strict_comparison2,strict_comparison1>,
Seq2=const boost::fusion::tuple2<strict_comparison1,strict_comparison2>,
I1=boost::fusion::meta::begin<const
boost::fusion::tuple2<strict_comparison2,strict_comparison1>>::type,
I2=boost::fusion::meta::begin<const
boost::fusion::tuple2<strict_comparison1,strict_comparison2>>::type
]
c:\data\boost\develop\boost\boost\spirit\fusion\sequence\less.hpp(32) : see
reference to function template instantiation 'bool
boost::fusion::detail::sequence_less<Seq1,Seq2>::call<boost::fusion::meta::begin<Sequence>::type,boost::fusion::meta::begin<const
boost::fusion::tuple2<T0,T1>>::type>(const I1 &,const I2 &)' being compiled
with
[
Seq1=const boost::fusion::tuple2<strict_comparison2,strict_comparison1>,
Seq2=const boost::fusion::tuple2<strict_comparison1,strict_comparison2>,
Sequence=const boost::fusion::tuple2<strict_comparison2,strict_comparison1>,
T0=strict_comparison1,
T1=strict_comparison2,
I1=boost::fusion::meta::begin<const
boost::fusion::tuple2<strict_comparison2,strict_comparison1>>::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(116) : see
reference to function template instantiation 'bool boost::fusion::operator
<<boost::fusion::tuple2<T0,T1>,boost::fusion::tuple2<strict_comparison1,strict_comparison2>>(const
boost::fusion::sequence_base<Sequence> &,const
boost::fusion::sequence_base<boost::fusion::tuple2<strict_comparison1,strict_comparison2>>
&)' being compiled
with
[
T0=strict_comparison2,
T1=strict_comparison1,
Sequence=boost::fusion::tuple2<strict_comparison2,strict_comparison1>
]
c:\data\boost\develop\boost\boost\spirit\fusion\sequence\detail\sequence_less.hpp(25)
: error C2784: 'disable_if<boost::fusion::is_sequence<Seq2>,bool>::type
boost::fusion::operator >(const boost::fusion::sequence_base<Seq1> &,const
Seq2 &)' : could not deduce template argument for 'const
boost::fusion::sequence_base<Sequence> &' 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\greater.hpp(39) :
see declaration of 'boost::fusion::operator`>''
c:\data\boost\develop\boost\boost\spirit\fusion\sequence\detail\sequence_less.hpp(25)
: error C2784: 'bool boost::fusion::operator >(const
boost::fusion::sequence_base<Seq1> &,const
boost::fusion::sequence_base<Seq2> &)' : could not deduce template argument
for 'const boost::fusion::sequence_base<Sequence> &' 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\greater.hpp(26) :
see declaration of 'boost::fusion::operator`>''
c:\data\boost\develop\boost\boost\spirit\fusion\sequence\detail\sequence_less.hpp(25)
: error C2676: binary '>' : 'const boost::add_const<T>::type' does not
define this operator or a conversion to a type acceptable to the predefined
operator
with
[
T=boost::mpl::v_at<boost::fusion::tuple_data2<strict_comparison1,strict_comparison2>::types,0>::type
]


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