mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-29 12:07:36 +02:00
bugfix tuples::null_type and tuples::tuple<> iterators not comparing ok.
[SVN r39359]
This commit is contained in:
@ -19,6 +19,24 @@ namespace boost { namespace fusion
|
||||
{
|
||||
struct forward_traversal_tag;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <typename T>
|
||||
struct boost_tuple_is_empty : mpl::false_ {};
|
||||
|
||||
template <>
|
||||
struct boost_tuple_is_empty<tuples::null_type> : mpl::true_ {};
|
||||
|
||||
template <>
|
||||
struct boost_tuple_is_empty<tuples::null_type const> : mpl::true_ {};
|
||||
|
||||
template <>
|
||||
struct boost_tuple_is_empty<tuples::tuple<> > : mpl::true_ {};
|
||||
|
||||
template <>
|
||||
struct boost_tuple_is_empty<tuples::tuple<> const> : mpl::true_ {};
|
||||
}
|
||||
|
||||
template <typename Cons = tuples::null_type>
|
||||
struct boost_tuple_iterator
|
||||
: iterator_facade<boost_tuple_iterator<Cons>, forward_traversal_tag>
|
||||
@ -72,11 +90,40 @@ namespace boost { namespace fusion
|
||||
return type(iter.cons.get_tail());
|
||||
}
|
||||
};
|
||||
|
||||
template <typename I1, typename I2>
|
||||
struct equal_to
|
||||
: mpl::or_<
|
||||
is_same<I1, I2>
|
||||
, mpl::and_<
|
||||
detail::boost_tuple_is_empty<typename I1::cons_type>
|
||||
, detail::boost_tuple_is_empty<typename I2::cons_type>
|
||||
>
|
||||
>
|
||||
{};
|
||||
};
|
||||
|
||||
template <typename Null>
|
||||
struct boost_tuple_null_iterator
|
||||
: iterator_facade<boost_tuple_iterator<Null>, forward_traversal_tag>
|
||||
{
|
||||
typedef Null cons_type;
|
||||
|
||||
template <typename I1, typename I2>
|
||||
struct equal_to
|
||||
: mpl::or_<
|
||||
is_same<I1, I2>
|
||||
, mpl::and_<
|
||||
detail::boost_tuple_is_empty<typename I1::cons_type>
|
||||
, detail::boost_tuple_is_empty<typename I2::cons_type>
|
||||
>
|
||||
>
|
||||
{};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct boost_tuple_iterator<tuples::null_type>
|
||||
: iterator_facade<boost_tuple_iterator<tuples::null_type>, forward_traversal_tag>
|
||||
: boost_tuple_null_iterator<tuples::null_type>
|
||||
{
|
||||
template <typename Cons>
|
||||
explicit boost_tuple_iterator(Cons const&) {}
|
||||
@ -84,7 +131,7 @@ namespace boost { namespace fusion
|
||||
|
||||
template <>
|
||||
struct boost_tuple_iterator<tuples::null_type const>
|
||||
: iterator_facade<boost_tuple_iterator<tuples::null_type const>, forward_traversal_tag>
|
||||
: boost_tuple_null_iterator<tuples::null_type const>
|
||||
{
|
||||
template <typename Cons>
|
||||
explicit boost_tuple_iterator(Cons const&) {}
|
||||
@ -92,7 +139,7 @@ namespace boost { namespace fusion
|
||||
|
||||
template <>
|
||||
struct boost_tuple_iterator<tuples::tuple<> >
|
||||
: iterator_facade<boost_tuple_iterator<tuples::tuple<> >, forward_traversal_tag>
|
||||
: boost_tuple_null_iterator<tuples::tuple<> >
|
||||
{
|
||||
template <typename Cons>
|
||||
explicit boost_tuple_iterator(Cons const&) {}
|
||||
@ -100,7 +147,7 @@ namespace boost { namespace fusion
|
||||
|
||||
template <>
|
||||
struct boost_tuple_iterator<tuples::tuple<> const>
|
||||
: iterator_facade<boost_tuple_iterator<tuples::tuple<> const>, forward_traversal_tag>
|
||||
: boost_tuple_null_iterator<tuples::tuple<> const>
|
||||
{
|
||||
template <typename Cons>
|
||||
explicit boost_tuple_iterator(Cons const&) {}
|
||||
|
Reference in New Issue
Block a user