adapted/array is now using iterator_facade

[SVN r35317]
This commit is contained in:
Joel de Guzman
2006-09-25 09:06:15 +00:00
parent 654fd0918e
commit f017aa86ce
28 changed files with 281 additions and 491 deletions

View File

@ -19,6 +19,9 @@
namespace boost { namespace fusion
{
struct random_access_traversal_tag;
// Special tags:
struct iterator_facade_tag; // iterator facade tag
struct array_iterator_tag; // boost::array iterator tag
struct mpl_iterator_tag; // mpl sequence iterator tag
struct std_pair_iterator_tag; // std::pair iterator tag
@ -37,11 +40,17 @@ namespace boost { namespace fusion
, advance_detail::backward<Iterator, N::value>
>::type
{
typedef typename traits::category_of<Iterator>::type category;
BOOST_MPL_ASSERT_NOT((is_same<category, random_access_traversal_tag>));
BOOST_MPL_ASSERT_NOT((traits::is_random_access<Iterator>));
};
};
template <>
struct advance_impl<iterator_facade_tag>
{
template <typename Iterator, typename N>
struct apply : Iterator::template advance<Iterator, N> {};
};
template <>
struct advance_impl<array_iterator_tag>;

View File

@ -13,6 +13,8 @@
namespace boost { namespace fusion
{
// Special tags:
struct iterator_facade_tag; // iterator facade tag
struct array_iterator_tag; // boost::array iterator tag
struct mpl_iterator_tag; // mpl sequence iterator tag
struct std_pair_iterator_tag; // std::pair iterator tag
@ -26,6 +28,13 @@ namespace boost { namespace fusion
struct apply {};
};
template <>
struct deref_impl<iterator_facade_tag>
{
template <typename Iterator>
struct apply : Iterator::template deref<Iterator> {};
};
template <>
struct deref_impl<array_iterator_tag>;

View File

@ -20,6 +20,9 @@
namespace boost { namespace fusion
{
struct random_access_traversal_tag;
// Special tags:
struct iterator_facade_tag; // iterator facade tag
struct array_iterator_tag; // boost::array iterator tag
struct mpl_iterator_tag; // mpl sequence iterator tag
struct std_pair_iterator_tag; // std::pair iterator tag
@ -33,13 +36,18 @@ namespace boost { namespace fusion
template <typename First, typename Last>
struct apply : distance_detail::linear_distance<First, Last>
{
typedef typename traits::category_of<First>::type first_category;
typedef typename traits::category_of<Last>::type last_category;
BOOST_MPL_ASSERT((is_same<first_category, last_category>));
BOOST_MPL_ASSERT_NOT((is_same<first_category, random_access_traversal_tag>));
BOOST_MPL_ASSERT_NOT((traits::is_random_access<First>));
BOOST_MPL_ASSERT_NOT((traits::is_random_access<Last>));
};
};
template <>
struct distance_impl<iterator_facade_tag>
{
template <typename First, typename Last>
struct apply : First::template distance<First, Last> {};
};
template <>
struct distance_impl<array_iterator_tag>;

View File

@ -17,6 +17,8 @@
namespace boost { namespace fusion
{
// Special tags:
struct iterator_facade_tag; // iterator facade tag
struct array_iterator_tag; // boost::array iterator tag
struct mpl_iterator_tag; // mpl sequence iterator tag
struct std_pair_iterator_tag; // std::pair iterator tag
@ -33,6 +35,13 @@ namespace boost { namespace fusion
{};
};
template <>
struct equal_to_impl<iterator_facade_tag>
{
template <typename I1, typename I2>
struct apply : I1::template equal_to<I1, I2> {};
};
template <>
struct equal_to_impl<array_iterator_tag>;

View File

@ -0,0 +1,35 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Use, modification and distribution is subject to 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_ITERATOR_FACADE_09252006_1011)
#define FUSION_ITERATOR_FACADE_09252006_1011
#include <boost/fusion/support/iterator_base.hpp>
#include <boost/type_traits/is_same.hpp>
namespace boost { namespace fusion
{
struct iterator_facade_tag;
template <typename Derived, typename Category>
struct iterator_facade : iterator_base<Derived>
{
typedef iterator_facade_tag fusion_tag;
typedef Derived derived_type;
typedef Category category;
template <typename I1, typename I2>
struct equal_to // default implementation
: is_same<
typename I1::derived_type
, typename I2::derived_type
>
{};
};
}}
#endif

View File

@ -12,6 +12,8 @@
namespace boost { namespace fusion
{
// Special tags:
struct iterator_facade_tag; // iterator facade tag
struct array_iterator_tag; // boost::array iterator tag
struct mpl_iterator_tag; // mpl sequence iterator tag
struct std_pair_iterator_tag; // std::pair iterator tag
@ -25,6 +27,13 @@ namespace boost { namespace fusion
struct apply {};
};
template <>
struct next_impl<iterator_facade_tag>
{
template <typename Iterator>
struct apply : Iterator::template next<Iterator> {};
};
template <>
struct next_impl<array_iterator_tag>;

View File

@ -12,6 +12,8 @@
namespace boost { namespace fusion
{
// Special tags:
struct iterator_facade_tag; // iterator facade tag
struct array_iterator_tag; // boost::array iterator tag
struct mpl_iterator_tag; // mpl sequence iterator tag
struct std_pair_iterator_tag; // std::pair iterator tag
@ -25,6 +27,13 @@ namespace boost { namespace fusion
struct apply {};
};
template <>
struct prior_impl<iterator_facade_tag>
{
template <typename Iterator>
struct apply : Iterator::template prior<Iterator> {};
};
template <>
struct prior_impl<array_iterator_tag>;

View File

@ -13,6 +13,8 @@
namespace boost { namespace fusion
{
// Special tags:
struct iterator_facade_tag; // iterator facade tag
struct array_iterator_tag; // boost::array iterator tag
struct mpl_iterator_tag; // mpl sequence iterator tag
struct std_pair_iterator_tag; // std::pair iterator tag
@ -26,6 +28,13 @@ namespace boost { namespace fusion
struct apply {};
};
template <>
struct value_of_impl<iterator_facade_tag>
{
template <typename Iterator>
struct apply : Iterator::template value_of<Iterator> {};
};
template <>
struct value_of_impl<array_iterator_tag>;