mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-16 13:52:24 +02:00
adds intrinsics to support the concept of the underlying sequence
[SVN r37232]
This commit is contained in:
@ -0,0 +1,44 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2007 Tobias Schwinger
|
||||||
|
|
||||||
|
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(BOOST_FUSION_ITERATOR_RANGE_AT_IMPL_HPP_INCLUDED)
|
||||||
|
#define BOOST_FUSION_ITERATOR_RANGE_AT_IMPL_HPP_INCLUDED
|
||||||
|
|
||||||
|
#include <boost/fusion/iterator/advance.hpp>
|
||||||
|
#include <boost/fusion/iterator/deref.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct iterator_range_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template <typename Tag>
|
||||||
|
struct at_impl;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct at_impl<iterator_range_tag>
|
||||||
|
{
|
||||||
|
template <typename Seq, typename N>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
typedef typename Seq::begin_type begin_type;
|
||||||
|
typedef typename result_of::advance<begin_type,N>::type pos;
|
||||||
|
typedef typename result_of::deref<pos>::type type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Seq& s)
|
||||||
|
{
|
||||||
|
return * advance<N>(s.first);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,38 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2007 Tobias Schwinger
|
||||||
|
|
||||||
|
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(BOOST_FUSION_ITERATOR_RANGE_VALUE_AT_IMPL_HPP_INCLUDED)
|
||||||
|
#define BOOST_FUSION_ITERATOR_RANGE_VALUE_AT_IMPL_HPP_INCLUDED
|
||||||
|
|
||||||
|
#include <boost/fusion/iterator/advance.hpp>
|
||||||
|
#include <boost/fusion/iterator/value_of.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct iterator_range_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template <typename Tag>
|
||||||
|
struct value_at_impl;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct value_at_impl<iterator_range_tag>
|
||||||
|
{
|
||||||
|
template <typename Seq, typename N>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
typedef typename Seq::begin_type begin_type;
|
||||||
|
typedef typename result_of::advance<begin_type,N>::type pos;
|
||||||
|
typedef typename result_of::value_of<pos>::type type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -12,6 +12,8 @@
|
|||||||
#include <boost/fusion/support/category_of.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/begin_impl.hpp>
|
||||||
#include <boost/fusion/sequence/view/iterator_range/detail/end_impl.hpp>
|
#include <boost/fusion/sequence/view/iterator_range/detail/end_impl.hpp>
|
||||||
|
#include <boost/fusion/sequence/view/iterator_range/detail/at_impl.hpp>
|
||||||
|
#include <boost/fusion/sequence/view/iterator_range/detail/value_at_impl.hpp>
|
||||||
#include <boost/fusion/iterator/mpl/convert_iterator.hpp>
|
#include <boost/fusion/iterator/mpl/convert_iterator.hpp>
|
||||||
#include <boost/fusion/iterator/distance.hpp>
|
#include <boost/fusion/iterator/distance.hpp>
|
||||||
#include <boost/mpl/bool.hpp>
|
#include <boost/mpl/bool.hpp>
|
||||||
@ -31,9 +33,7 @@ namespace boost { namespace fusion
|
|||||||
typedef typename result_of::distance<begin_type, end_type>::type size;
|
typedef typename result_of::distance<begin_type, end_type>::type size;
|
||||||
typedef mpl::true_ is_view;
|
typedef mpl::true_ is_view;
|
||||||
|
|
||||||
typedef forward_traversal_tag category;
|
typedef typename traits::category_of<begin_type>::type category;
|
||||||
// typedef typename traits::category_of<begin_type>::type category;
|
|
||||||
// TODO: make it work - tosh
|
|
||||||
|
|
||||||
iterator_range(First const& first, Last const& last)
|
iterator_range(First const& first, Last const& last)
|
||||||
: first(convert_iterator<First>::call(first))
|
: first(convert_iterator<First>::call(first))
|
||||||
|
Reference in New Issue
Block a user