diff --git a/include/boost/fusion/sequence/adapted/boost_tuple/boost_tuple_iterator.hpp b/include/boost/fusion/sequence/adapted/boost_tuple/boost_tuple_iterator.hpp index f92ef8b6..2becfbd5 100644 --- a/include/boost/fusion/sequence/adapted/boost_tuple/boost_tuple_iterator.hpp +++ b/include/boost/fusion/sequence/adapted/boost_tuple/boost_tuple_iterator.hpp @@ -1,7 +1,7 @@ /*============================================================================= 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) ==============================================================================*/ #if !defined(FUSION_BOOST_TUPLE_ITERATOR_09262006_1851) @@ -19,6 +19,24 @@ namespace boost { namespace fusion { struct forward_traversal_tag; + namespace detail + { + template + struct boost_tuple_is_empty : mpl::false_ {}; + + template <> + struct boost_tuple_is_empty : mpl::true_ {}; + + template <> + struct boost_tuple_is_empty : mpl::true_ {}; + + template <> + struct boost_tuple_is_empty > : mpl::true_ {}; + + template <> + struct boost_tuple_is_empty const> : mpl::true_ {}; + } + template struct boost_tuple_iterator : iterator_facade, forward_traversal_tag> @@ -36,13 +54,13 @@ namespace boost { namespace fusion struct deref { typedef typename value_of::type element; - - typedef typename + + typedef typename mpl::if_< is_const , typename tuples::access_traits::const_type , typename tuples::access_traits::non_const_type - >::type + >::type type; static type @@ -72,11 +90,40 @@ namespace boost { namespace fusion return type(iter.cons.get_tail()); } }; + + template + struct equal_to + : mpl::or_< + is_same + , mpl::and_< + detail::boost_tuple_is_empty + , detail::boost_tuple_is_empty + > + > + {}; + }; + + template + struct boost_tuple_null_iterator + : iterator_facade, forward_traversal_tag> + { + typedef Null cons_type; + + template + struct equal_to + : mpl::or_< + is_same + , mpl::and_< + detail::boost_tuple_is_empty + , detail::boost_tuple_is_empty + > + > + {}; }; template <> struct boost_tuple_iterator - : iterator_facade, forward_traversal_tag> + : boost_tuple_null_iterator { template explicit boost_tuple_iterator(Cons const&) {} @@ -84,7 +131,7 @@ namespace boost { namespace fusion template <> struct boost_tuple_iterator - : iterator_facade, forward_traversal_tag> + : boost_tuple_null_iterator { template explicit boost_tuple_iterator(Cons const&) {} @@ -92,7 +139,7 @@ namespace boost { namespace fusion template <> struct boost_tuple_iterator > - : iterator_facade >, forward_traversal_tag> + : boost_tuple_null_iterator > { template explicit boost_tuple_iterator(Cons const&) {} @@ -100,7 +147,7 @@ namespace boost { namespace fusion template <> struct boost_tuple_iterator const> - : iterator_facade const>, forward_traversal_tag> + : boost_tuple_null_iterator const> { template explicit boost_tuple_iterator(Cons const&) {}