forked from boostorg/fusion
fusion: merge of associative iterators/views and the new fold interface
[SVN r58618]
This commit is contained in:
41
include/boost/fusion/view/reverse_view/detail/at_impl.hpp
Normal file
41
include/boost/fusion/view/reverse_view/detail/at_impl.hpp
Normal file
@ -0,0 +1,41 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2009 Christopher Schmidt
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef BOOST_FUSION_VIEW_REVERSE_VIEW_DETAIL_AT_IMPL_HPP
|
||||
#define BOOST_FUSION_VIEW_REVERSE_VIEW_DETAIL_AT_IMPL_HPP
|
||||
|
||||
#include <boost/fusion/sequence/intrinsic/at.hpp>
|
||||
#include <boost/mpl/minus.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace extension
|
||||
{
|
||||
template <typename>
|
||||
struct at_impl;
|
||||
|
||||
template <>
|
||||
struct at_impl<reverse_view_tag>
|
||||
{
|
||||
template <typename Seq, typename N>
|
||||
struct apply
|
||||
{
|
||||
typedef mpl::minus<typename Seq::size, mpl::int_<1>, N> real_n;
|
||||
|
||||
typedef typename
|
||||
result_of::at<typename Seq::seq_type, real_n>::type
|
||||
type;
|
||||
|
||||
static type
|
||||
call(Seq& seq)
|
||||
{
|
||||
return fusion::at<real_n>(seq.seq);
|
||||
}
|
||||
};
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
@ -0,0 +1,37 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2009 Christopher Schmidt
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef BOOST_FUSION_VIEW_REVERSE_VIEW_DETAIL_DEREF_DATA_IMPL_HPP
|
||||
#define BOOST_FUSION_VIEW_REVERSE_VIEW_DETAIL_DEREF_DATA_IMPL_HPP
|
||||
|
||||
#include <boost/fusion/iterator/deref_data.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace extension
|
||||
{
|
||||
template <typename>
|
||||
struct deref_data_impl;
|
||||
|
||||
template <>
|
||||
struct deref_data_impl<reverse_view_iterator_tag>
|
||||
{
|
||||
template <typename It>
|
||||
struct apply
|
||||
{
|
||||
typedef typename
|
||||
result_of::deref_data<typename It::first_type>::type
|
||||
type;
|
||||
|
||||
static type
|
||||
call(It const& it)
|
||||
{
|
||||
return fusion::deref_data(it.first);
|
||||
}
|
||||
};
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
@ -0,0 +1,28 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2009 Christopher Schmidt
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef BOOST_FUSION_VIEW_REVERSE_VIEW_DETAIL_KEY_OF_IMPL_HPP
|
||||
#define BOOST_FUSION_VIEW_REVERSE_VIEW_DETAIL_KEY_OF_IMPL_HPP
|
||||
|
||||
#include <boost/fusion/iterator/key_of.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace extension
|
||||
{
|
||||
template <typename>
|
||||
struct key_of_impl;
|
||||
|
||||
template <>
|
||||
struct key_of_impl<reverse_view_iterator_tag>
|
||||
{
|
||||
template <typename It>
|
||||
struct apply
|
||||
: result_of::key_of<typename It::it_type>
|
||||
{};
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
@ -0,0 +1,33 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2009 Christopher Schmidt
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef BOOST_FUSION_VIEW_REVERSE_VIEW_DETAIL_VALUE_AT_IMPL_HPP
|
||||
#define BOOST_FUSION_VIEW_REVERSE_VIEW_DETAIL_VALUE_AT_IMPL_HPP
|
||||
|
||||
#include <boost/fusion/sequence/intrinsic/value_at.hpp>
|
||||
#include <boost/mpl/minus.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace extension
|
||||
{
|
||||
template <typename>
|
||||
struct value_at_impl;
|
||||
|
||||
template <>
|
||||
struct value_at_impl<reverse_view_tag>
|
||||
{
|
||||
template <typename Seq, typename N>
|
||||
struct apply
|
||||
: result_of::value_at<
|
||||
typename Seq::seq_type
|
||||
, mpl::minus<typename Seq::size, mpl::int_<1>, N>
|
||||
>
|
||||
{};
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
@ -0,0 +1,28 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2009 Christopher Schmidt
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef BOOST_FUSION_VIEW_REVERSE_VIEW_DETAIL_VALUE_OF_DATA_IMPL_HPP
|
||||
#define BOOST_FUSION_VIEW_REVERSE_VIEW_DETAIL_VALUE_OF_DATA_IMPL_HPP
|
||||
|
||||
#include <boost/fusion/iterator/value_of_data.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace extension
|
||||
{
|
||||
template <typename>
|
||||
struct value_of_data_impl;
|
||||
|
||||
template <>
|
||||
struct value_of_data_impl<reverse_view_iterator_tag>
|
||||
{
|
||||
template <typename It>
|
||||
struct apply
|
||||
: result_of::value_of_data<typename It::first_type>
|
||||
{};
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
@ -13,6 +13,8 @@
|
||||
#include <boost/fusion/view/reverse_view/reverse_view_iterator.hpp>
|
||||
#include <boost/fusion/view/reverse_view/detail/begin_impl.hpp>
|
||||
#include <boost/fusion/view/reverse_view/detail/end_impl.hpp>
|
||||
#include <boost/fusion/view/reverse_view/detail/at_impl.hpp>
|
||||
#include <boost/fusion/view/reverse_view/detail/value_at_impl.hpp>
|
||||
#include <boost/fusion/support/sequence_base.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||
@ -20,6 +22,9 @@
|
||||
#include <boost/type_traits/is_base_of.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/inherit.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
@ -33,6 +38,7 @@ namespace boost { namespace fusion
|
||||
typedef fusion_sequence_tag tag; // this gets picked up by MPL
|
||||
typedef mpl::true_ is_view;
|
||||
|
||||
typedef Sequence seq_type;
|
||||
typedef typename traits::category_of<Sequence>::type category;
|
||||
typedef typename result_of::begin<Sequence>::type first_type;
|
||||
typedef typename result_of::end<Sequence>::type last_type;
|
||||
|
@ -17,6 +17,9 @@
|
||||
#include <boost/fusion/view/reverse_view/detail/advance_impl.hpp>
|
||||
#include <boost/fusion/view/reverse_view/detail/distance_impl.hpp>
|
||||
#include <boost/fusion/view/reverse_view/detail/value_of_impl.hpp>
|
||||
#include <boost/fusion/view/reverse_view/detail/deref_data_impl.hpp>
|
||||
#include <boost/fusion/view/reverse_view/detail/value_of_data_impl.hpp>
|
||||
#include <boost/fusion/view/reverse_view/detail/key_of_impl.hpp>
|
||||
#include <boost/type_traits/is_base_of.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
|
Reference in New Issue
Block a user