forked from boostorg/fusion
associative iterators & views
[SVN r57156]
This commit is contained in:
@@ -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,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
|
@@ -20,6 +20,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
|
||||
{
|
||||
@@ -32,8 +35,15 @@ namespace boost { namespace fusion
|
||||
typedef reverse_view_tag fusion_tag;
|
||||
typedef fusion_sequence_tag tag; // this gets picked up by MPL
|
||||
typedef mpl::true_ is_view;
|
||||
typedef typename traits::category_of<Sequence>::type seq_category;
|
||||
|
||||
typedef typename traits::category_of<Sequence>::type category;
|
||||
typedef typename
|
||||
mpl::eval_if<
|
||||
traits::is_associative<Sequence>
|
||||
, mpl::inherit2<seq_category,associative_sequence_tag>
|
||||
, mpl::identity<seq_category>
|
||||
>::type
|
||||
category;
|
||||
typedef typename result_of::begin<Sequence>::type first_type;
|
||||
typedef typename result_of::end<Sequence>::type last_type;
|
||||
typedef typename result_of::size<Sequence>::type size;
|
||||
|
@@ -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