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:
@ -1,7 +1,7 @@
|
|||||||
/*=============================================================================
|
/*=============================================================================
|
||||||
Copyright (c) 2001-2006 Joel de Guzman
|
Copyright (c) 2001-2006 Joel de Guzman
|
||||||
|
|
||||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
==============================================================================*/
|
==============================================================================*/
|
||||||
#if !defined(FUSION_BOOST_TUPLE_ITERATOR_09262006_1851)
|
#if !defined(FUSION_BOOST_TUPLE_ITERATOR_09262006_1851)
|
||||||
@ -19,6 +19,24 @@ namespace boost { namespace fusion
|
|||||||
{
|
{
|
||||||
struct forward_traversal_tag;
|
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>
|
template <typename Cons = tuples::null_type>
|
||||||
struct boost_tuple_iterator
|
struct boost_tuple_iterator
|
||||||
: iterator_facade<boost_tuple_iterator<Cons>, forward_traversal_tag>
|
: iterator_facade<boost_tuple_iterator<Cons>, forward_traversal_tag>
|
||||||
@ -36,13 +54,13 @@ namespace boost { namespace fusion
|
|||||||
struct deref
|
struct deref
|
||||||
{
|
{
|
||||||
typedef typename value_of<Iterator>::type element;
|
typedef typename value_of<Iterator>::type element;
|
||||||
|
|
||||||
typedef typename
|
typedef typename
|
||||||
mpl::if_<
|
mpl::if_<
|
||||||
is_const<typename Iterator::cons_type>
|
is_const<typename Iterator::cons_type>
|
||||||
, typename tuples::access_traits<element>::const_type
|
, typename tuples::access_traits<element>::const_type
|
||||||
, typename tuples::access_traits<element>::non_const_type
|
, typename tuples::access_traits<element>::non_const_type
|
||||||
>::type
|
>::type
|
||||||
type;
|
type;
|
||||||
|
|
||||||
static type
|
static type
|
||||||
@ -72,11 +90,40 @@ namespace boost { namespace fusion
|
|||||||
return type(iter.cons.get_tail());
|
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 <>
|
template <>
|
||||||
struct boost_tuple_iterator<tuples::null_type>
|
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>
|
template <typename Cons>
|
||||||
explicit boost_tuple_iterator(Cons const&) {}
|
explicit boost_tuple_iterator(Cons const&) {}
|
||||||
@ -84,7 +131,7 @@ namespace boost { namespace fusion
|
|||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct boost_tuple_iterator<tuples::null_type const>
|
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>
|
template <typename Cons>
|
||||||
explicit boost_tuple_iterator(Cons const&) {}
|
explicit boost_tuple_iterator(Cons const&) {}
|
||||||
@ -92,7 +139,7 @@ namespace boost { namespace fusion
|
|||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct boost_tuple_iterator<tuples::tuple<> >
|
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>
|
template <typename Cons>
|
||||||
explicit boost_tuple_iterator(Cons const&) {}
|
explicit boost_tuple_iterator(Cons const&) {}
|
||||||
@ -100,7 +147,7 @@ namespace boost { namespace fusion
|
|||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct boost_tuple_iterator<tuples::tuple<> const>
|
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>
|
template <typename Cons>
|
||||||
explicit boost_tuple_iterator(Cons const&) {}
|
explicit boost_tuple_iterator(Cons const&) {}
|
||||||
|
Reference in New Issue
Block a user