forked from boostorg/fusion
Initial move from Spirit CVS
[SVN r34896]
This commit is contained in:
@ -0,0 +1,40 @@
|
||||
/*=============================================================================
|
||||
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_BEGIN_IMPL_05062005_1226)
|
||||
#define FUSION_BEGIN_IMPL_05062005_1226
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct iterator_range_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct begin_impl;
|
||||
|
||||
template <>
|
||||
struct begin_impl<iterator_range_tag>
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply
|
||||
{
|
||||
typedef typename Sequence::begin_type type;
|
||||
|
||||
static type
|
||||
call(Sequence& s)
|
||||
{
|
||||
return s.first;
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -0,0 +1,40 @@
|
||||
/*=============================================================================
|
||||
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_END_IMPL_05062005_1226)
|
||||
#define FUSION_END_IMPL_05062005_1226
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct iterator_range_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct end_impl;
|
||||
|
||||
template <>
|
||||
struct end_impl<iterator_range_tag>
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply
|
||||
{
|
||||
typedef typename Sequence::end_type type;
|
||||
|
||||
static type
|
||||
call(Sequence& s)
|
||||
{
|
||||
return s.last;
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -0,0 +1,53 @@
|
||||
/*=============================================================================
|
||||
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_RANGE_05062005_1224)
|
||||
#define FUSION_ITERATOR_RANGE_05062005_1224
|
||||
|
||||
#include <boost/fusion/support/detail/access.hpp>
|
||||
#include <boost/fusion/support/detail/iterator_to_sequence_category.hpp>
|
||||
#include <boost/fusion/support/sequence_base.hpp>
|
||||
#include <boost/fusion/support/category_of.hpp>
|
||||
#include <boost/fusion/sequence/view/iterator_range/detail/begin_impl.hpp>
|
||||
#include <boost/fusion/sequence/view/iterator_range/detail/end_impl.hpp>
|
||||
#include <boost/fusion/iterator/mpl/convert_iterator.hpp>
|
||||
#include <boost/fusion/iterator/distance.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct iterator_range_tag;
|
||||
struct fusion_sequence_tag;
|
||||
|
||||
template <typename First, typename Last>
|
||||
struct iterator_range : sequence_base<iterator_range<First, Last> >
|
||||
{
|
||||
typedef typename convert_iterator<First>::type begin_type;
|
||||
typedef typename convert_iterator<Last>::type end_type;
|
||||
typedef iterator_range_tag ftag;
|
||||
typedef fusion_sequence_tag tag; // this gets picked up by MPL
|
||||
typedef typename result_of::distance<begin_type, end_type>::type size;
|
||||
typedef mpl::true_ is_view;
|
||||
|
||||
typedef typename
|
||||
detail::iterator_to_sequence_category<
|
||||
typename traits::category_of<begin_type>::type
|
||||
>::type
|
||||
category;
|
||||
|
||||
iterator_range(First const& first, Last const& last)
|
||||
: first(convert_iterator<First>::call(first))
|
||||
, last(convert_iterator<Last>::call(last)) {}
|
||||
|
||||
begin_type first;
|
||||
end_type last;
|
||||
};
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user