Files
boost_fusion/include/boost/fusion/iterator/iterator_facade.hpp

58 lines
1.8 KiB
C++
Raw Normal View History

/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
2009-09-14 07:40:39 +00:00
Distributed under the Boost Software License, Version 1.0. (See accompanying
2007-03-02 10:44:14 +00:00
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>
2006-11-13 01:16:28 +00:00
#include <boost/fusion/iterator/detail/advance.hpp>
2009-09-14 07:40:39 +00:00
#include <boost/fusion/iterator/detail/distance.hpp>
2006-11-13 09:28:04 +00:00
#include <boost/fusion/support/category_of.hpp>
#include <boost/type_traits/is_same.hpp>
2006-11-13 01:16:28 +00:00
#include <boost/mpl/assert.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;
2006-11-13 01:16:28 +00:00
// default implementation
template <typename I1, typename I2>
struct equal_to // default implementation
: is_same<
typename I1::derived_type
, typename I2::derived_type
>
{};
2006-11-13 01:16:28 +00:00
// default implementation
template <typename Iterator, typename N>
struct advance :
mpl::if_c<
(N::value > 0)
, advance_detail::forward<Iterator, N::value>
, advance_detail::backward<Iterator, N::value>
>::type
{
BOOST_MPL_ASSERT_NOT((traits::is_random_access<Iterator>));
};
2009-09-14 07:40:39 +00:00
// default implementation
template <typename First, typename Last>
struct distance :
distance_detail::linear_distance<First, Last>
{};
};
}}
#endif