fusion: merge of associative iterators/views and the new fold interface

[SVN r58618]
This commit is contained in:
Christopher Schmidt
2010-01-01 22:00:21 +00:00
parent b605617c4f
commit cda74605fc
379 changed files with 28481 additions and 2185 deletions

View File

@ -42,8 +42,8 @@ namespace boost { namespace fusion
template<typename Sig>
struct result;
template<typename Next, typename StrictestSoFar>
struct result<strictest_traversal_impl(Next, StrictestSoFar)>
template<typename StrictestSoFar, typename Next>
struct result<strictest_traversal_impl(StrictestSoFar, Next)>
{
typedef typename remove_reference<Next>::type next_value;
typedef typename remove_reference<StrictestSoFar>::type strictest_so_far;

View File

@ -9,8 +9,10 @@
#define FUSION_SEGMENTED_ITERATOR_EAN_05032006_1027
#include <boost/mpl/if.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/not.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/next_prior.hpp>
#include <boost/mpl/placeholders.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/is_reference.hpp>
@ -20,6 +22,7 @@
#include <boost/fusion/view/filter_view.hpp>
#include <boost/fusion/container/list/cons.hpp> // for nil
#include <boost/fusion/container/generation/make_cons.hpp>
#include <boost/fusion/iterator/advance.hpp>
#include <boost/fusion/iterator/distance.hpp>
#include <boost/fusion/sequence/intrinsic/ext_/segments.hpp>
#include <boost/fusion/support/ext_/is_segmented.hpp>
@ -59,16 +62,15 @@ namespace boost { namespace fusion
struct segmented_range_tag;
////////////////////////////////////////////////////////////////////////////
template<typename Sequence, typename Iterator, bool IsSegmented>
template<typename Sequence, typename Index, bool IsSegmented>
struct segmented_range
: sequence_base<segmented_range<Sequence, Iterator, IsSegmented> >
: sequence_base<segmented_range<Sequence, Index, IsSegmented> >
{
BOOST_MPL_ASSERT_NOT((is_reference<Sequence>));
typedef mpl::bool_<IsSegmented> is_segmented;
typedef segmented_range_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef mpl::true_ is_view;
typedef Iterator iterator_type;
// If this is a range of segments, skip over the empty ones
typedef typename mpl::if_<
@ -83,20 +85,34 @@ namespace boost { namespace fusion
, sequence_non_ref_type &
>::type sequence_type;
typedef
typename fusion::result_of::advance<
typename fusion::result_of::begin<sequence_non_ref_type>::type
, Index
>::type
iterator_type;
typedef typename traits::category_of<sequence_non_ref_type>::type category;
explicit segmented_range(Sequence &sequence_)
: sequence(sequence_type(sequence_))
, where_(fusion::begin(sequence))
{}
segmented_range(sequence_type sequence_, iterator_type const &wh)
segmented_range(sequence_type sequence_, int)
: sequence(sequence_)
, where_(wh)
{}
iterator_type where_() const
{
return fusion::advance<Index>(
fusion::begin(const_cast<sequence_non_ref_type &>(this->sequence))
);
}
sequence_type sequence;
iterator_type where_;
private:
segmented_range &operator =(segmented_range const &);
};
}
@ -148,7 +164,7 @@ namespace boost { namespace fusion
typedef typename Sequence::iterator_type type;
static type call(Sequence &seq)
{
return seq.where_;
return seq.where_();
}
};
};
@ -176,15 +192,15 @@ namespace boost { namespace fusion
template<typename Range>
struct range_next;
template<typename Sequence, typename Iterator, bool IsSegmented>
struct range_next<segmented_range<Sequence, Iterator, IsSegmented> >
template<typename Sequence, typename Index, bool IsSegmented>
struct range_next<segmented_range<Sequence, Index, IsSegmented> >
{
typedef typename result_of::next<Iterator>::type iterator_type;
typedef segmented_range<Sequence, iterator_type, IsSegmented> type;
typedef typename mpl::next<Index>::type index_type;
typedef segmented_range<Sequence, index_type, IsSegmented> type;
static type call(segmented_range<Sequence, Iterator, IsSegmented> const &rng)
static type call(segmented_range<Sequence, Index, IsSegmented> const &rng)
{
return type(rng.sequence, fusion::next(rng.where_));
return type(rng.sequence, 0);
}
};
@ -205,8 +221,7 @@ namespace boost { namespace fusion
{
typedef typename result_of::segments<Sequence>::type segments;
typedef typename remove_reference<segments>::type sequence;
typedef typename result_of::begin<filter_view<sequence, not_is_empty_pred> >::type begin;
typedef segmented_range<sequence, begin, true> type;
typedef segmented_range<sequence, mpl::int_<0>, true> type;
static type call(Sequence &seq)
{
@ -219,8 +234,7 @@ namespace boost { namespace fusion
struct as_segmented_range<Sequence, false>
{
typedef typename remove_reference<Sequence>::type sequence;
typedef typename result_of::begin<sequence>::type begin;
typedef segmented_range<sequence, begin, false> type;
typedef segmented_range<sequence, mpl::int_<0>, false> type;
static type call(Sequence &seq)
{
@ -228,10 +242,10 @@ namespace boost { namespace fusion
}
};
template<typename Sequence, typename Iterator, bool IsSegmented>
struct as_segmented_range<segmented_range<Sequence, Iterator, IsSegmented>, IsSegmented>
template<typename Sequence, typename Index, bool IsSegmented>
struct as_segmented_range<segmented_range<Sequence, Index, IsSegmented>, IsSegmented>
{
typedef segmented_range<Sequence, Iterator, IsSegmented> type;
typedef segmented_range<Sequence, Index, IsSegmented> type;
static type &call(type &seq)
{
return seq;

View File

@ -11,7 +11,7 @@ namespace boost { namespace fusion
{
struct filter_view_tag;
template <typename First, typename Last, typename Pred>
template <typename Category, typename First, typename Last, typename Pred>
struct filter_iterator;
namespace extension
@ -28,7 +28,8 @@ namespace boost { namespace fusion
typedef typename Sequence::first_type first_type;
typedef typename Sequence::last_type last_type;
typedef typename Sequence::pred_type pred_type;
typedef filter_iterator<first_type, last_type, pred_type> type;
typedef typename Sequence::category category;
typedef filter_iterator<category, first_type, last_type, pred_type> type;
static type
call(Sequence& s)

View File

@ -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_FILTER_VIEW_DETAIL_DEREF_DATA_IMPL_HPP
#define BOOST_FUSION_VIEW_FILTER_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<filter_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

View File

@ -11,7 +11,7 @@ namespace boost { namespace fusion
{
struct filter_view_tag;
template <typename First, typename Last, typename Pred>
template <typename Category, typename First, typename Last, typename Pred>
struct filter_iterator;
namespace extension
@ -27,7 +27,8 @@ namespace boost { namespace fusion
{
typedef typename Sequence::last_type last_type;
typedef typename Sequence::pred_type pred_type;
typedef filter_iterator<last_type, last_type, pred_type> type;
typedef typename Sequence::category category;
typedef filter_iterator<category,last_type, last_type, pred_type> type;
static type
call(Sequence& s)

View File

@ -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_FILTER_VIEW_DETAIL_KEY_OF_IMPL_HPP
#define BOOST_FUSION_VIEW_FILTER_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<filter_view_iterator_tag>
{
template <typename It>
struct apply
: result_of::key_of<typename It::first_type>
{};
};
}}}
#endif

View File

@ -8,14 +8,19 @@
#define FUSION_NEXT_IMPL_06052005_0900
#include <boost/fusion/algorithm/query/detail/find_if.hpp>
#include <boost/fusion/iterator/value_of.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/mpl/lambda.hpp>
#include <boost/mpl/quote.hpp>
#include <boost/mpl/bind.hpp>
#include <boost/mpl/placeholders.hpp>
namespace boost { namespace fusion
{
struct filter_view_iterator_tag;
template <typename First, typename Last, typename Pred>
template <typename Category, typename First, typename Last, typename Pred>
struct filter_iterator;
namespace extension
@ -32,6 +37,7 @@ namespace boost { namespace fusion
typedef typename Iterator::first_type first_type;
typedef typename Iterator::last_type last_type;
typedef typename Iterator::pred_type pred_type;
typedef typename Iterator::category category;
typedef typename
mpl::eval_if<
@ -41,12 +47,19 @@ namespace boost { namespace fusion
>::type
next_type;
typedef typename detail::static_find_if<
next_type, last_type, pred_type>
typedef typename
detail::static_find_if<
next_type
, last_type
, mpl::bind1<
typename mpl::lambda<pred_type>::type
, mpl::bind1<mpl::quote1<result_of::value_of>,mpl::_1>
>
>
filter;
typedef filter_iterator<
typename filter::type, last_type, pred_type>
category, typename filter::type, last_type, pred_type>
type;
static type

View File

@ -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_FILTER_VIEW_DETAIL_VALUE_OF_DATA_IMPL_HPP
#define BOOST_FUSION_VIEW_FILTER_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<filter_view_iterator_tag>
{
template <typename It>
struct apply
: result_of::value_of_data<typename It::first_type>
{};
};
}}}
#endif

View File

@ -17,6 +17,10 @@
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/end.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
{
@ -29,7 +33,13 @@ namespace boost { namespace fusion
{
typedef filter_view_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef forward_traversal_tag category;
typedef typename
mpl::eval_if<
traits::is_associative<Sequence>
, mpl::inherit2<forward_traversal_tag,associative_tag>
, mpl::identity<forward_traversal_tag>
>::type
category;
typedef mpl::true_ is_view;
typedef typename result_of::begin<Sequence>::type first_type;

View File

@ -9,20 +9,29 @@
#include <boost/fusion/iterator/mpl/convert_iterator.hpp>
#include <boost/fusion/adapted/mpl/mpl_iterator.hpp>
#include <boost/fusion/iterator/value_of.hpp>
#include <boost/fusion/support/iterator_base.hpp>
#include <boost/fusion/algorithm/query/detail/find_if.hpp>
#include <boost/mpl/lambda.hpp>
#include <boost/mpl/quote.hpp>
#include <boost/mpl/bind.hpp>
#include <boost/mpl/placeholders.hpp>
#include <boost/fusion/view/filter_view/detail/deref_impl.hpp>
#include <boost/fusion/view/filter_view/detail/next_impl.hpp>
#include <boost/fusion/view/filter_view/detail/value_of_impl.hpp>
#include <boost/fusion/view/filter_view/detail/equal_to_impl.hpp>
#include <boost/fusion/algorithm/query/detail/find_if.hpp>
#include <boost/fusion/view/filter_view/detail/deref_data_impl.hpp>
#include <boost/fusion/view/filter_view/detail/value_of_data_impl.hpp>
#include <boost/fusion/view/filter_view/detail/key_of_impl.hpp>
namespace boost { namespace fusion
{
struct filter_view_iterator_tag;
struct forward_traversal_tag;
template <typename First, typename Last, typename Pred>
struct filter_iterator : iterator_base<filter_iterator<First, Last, Pred> >
template <typename Category, typename First, typename Last, typename Pred>
struct filter_iterator : iterator_base<filter_iterator<Category, First, Last, Pred> >
{
typedef convert_iterator<First> first_converter;
typedef typename first_converter::type first_iter;
@ -30,8 +39,17 @@ namespace boost { namespace fusion
typedef typename last_converter::type last_iter;
typedef filter_view_iterator_tag fusion_tag;
typedef forward_traversal_tag category;
typedef detail::static_find_if<first_iter, last_iter, Pred> filter;
typedef Category category;
typedef
detail::static_find_if<
first_iter
, last_iter
, mpl::bind1<
typename mpl::lambda<Pred>::type
, mpl::bind1<mpl::quote1<result_of::value_of>,mpl::_1>
>
>
filter;
typedef typename filter::type first_type;
typedef last_iter last_type;
typedef Pred pred_type;

View File

@ -17,7 +17,6 @@
#include <boost/fusion/view/iterator_range/detail/at_impl.hpp>
#include <boost/fusion/view/iterator_range/detail/value_at_impl.hpp>
#include <boost/fusion/adapted/mpl/mpl_iterator.hpp>
#include <boost/mpl/bool.hpp>
namespace boost { namespace fusion
{

View File

@ -14,7 +14,7 @@ namespace boost { namespace fusion
{
struct joint_view_tag;
template <typename First, typename Last, typename Concat>
template <typename Category, typename First, typename Last, typename Concat>
struct joint_view_iterator;
namespace extension
@ -31,13 +31,14 @@ namespace boost { namespace fusion
typedef typename Sequence::first_type first_type;
typedef typename Sequence::last_type last_type;
typedef typename Sequence::concat_type concat_type;
typedef typename Sequence::category category;
typedef result_of::equal_to<first_type, last_type> equal_to;
typedef typename
mpl::if_<
equal_to
, concat_type
, joint_view_iterator<first_type, last_type, concat_type>
, joint_view_iterator<category, first_type, last_type, concat_type>
>::type
type;

View File

@ -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_JOINT_VIEW_DETAIL_DEREF_DATA_IMPL_HPP
#define BOOST_FUSION_VIEW_JOINT_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<joint_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

View File

@ -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_JOINT_VIEW_DETAIL_KEY_OF_IMPL_HPP
#define BOOST_FUSION_VIEW_JOINT_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<joint_view_iterator_tag>
{
template <typename It>
struct apply
: result_of::key_of<typename It::first_type>
{};
};
}}}
#endif

View File

@ -15,7 +15,7 @@ namespace boost { namespace fusion
{
struct joint_view_iterator_tag;
template <typename First, typename Last, typename Concat>
template <typename Category, typename First, typename Last, typename Concat>
struct joint_view_iterator;
namespace extension
@ -32,6 +32,7 @@ namespace boost { namespace fusion
typedef typename Iterator::first_type first_type;
typedef typename Iterator::last_type last_type;
typedef typename Iterator::concat_type concat_type;
typedef typename Iterator::category category;
typedef typename result_of::next<first_type>::type next_type;
typedef result_of::equal_to<next_type, last_type> equal_to;
@ -39,7 +40,7 @@ namespace boost { namespace fusion
mpl::if_<
equal_to
, concat_type
, joint_view_iterator<next_type, last_type, concat_type>
, joint_view_iterator<category, next_type, last_type, concat_type>
>::type
type;

View File

@ -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_JOINT_VIEW_DETAIL_VALUE_OF_DATA_IMPL_HPP
#define BOOST_FUSION_VIEW_JOINT_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<joint_view_iterator_tag>
{
template <typename It>
struct apply
: result_of::value_of_data<typename It::first_type>
{};
};
}}}
#endif

View File

@ -19,6 +19,9 @@
#include <boost/mpl/if.hpp>
#include <boost/mpl/plus.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
{
@ -31,7 +34,16 @@ namespace boost { namespace fusion
{
typedef joint_view_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef forward_traversal_tag category;
typedef typename
mpl::eval_if<
mpl::and_<
traits::is_associative<Sequence1>
, traits::is_associative<Sequence2>
>
, mpl::inherit2<forward_traversal_tag,associative_tag>
, mpl::identity<forward_traversal_tag>
>::type
category;
typedef mpl::true_ is_view;
typedef typename result_of::begin<Sequence1>::type first_type;

View File

@ -14,6 +14,9 @@
#include <boost/fusion/view/joint_view/detail/deref_impl.hpp>
#include <boost/fusion/view/joint_view/detail/next_impl.hpp>
#include <boost/fusion/view/joint_view/detail/value_of_impl.hpp>
#include <boost/fusion/view/joint_view/detail/deref_data_impl.hpp>
#include <boost/fusion/view/joint_view/detail/value_of_data_impl.hpp>
#include <boost/fusion/view/joint_view/detail/key_of_impl.hpp>
#include <boost/static_assert.hpp>
namespace boost { namespace fusion
@ -21,9 +24,9 @@ namespace boost { namespace fusion
struct joint_view_iterator_tag;
struct forward_traversal_tag;
template <typename First, typename Last, typename Concat>
template <typename Category, typename First, typename Last, typename Concat>
struct joint_view_iterator
: iterator_base<joint_view_iterator<First, Last, Concat> >
: iterator_base<joint_view_iterator<Category, First, Last, Concat> >
{
typedef convert_iterator<First> first_converter;
typedef convert_iterator<Last> last_converter;
@ -34,7 +37,7 @@ namespace boost { namespace fusion
typedef typename concat_converter::type concat_type;
typedef joint_view_iterator_tag fusion_tag;
typedef forward_traversal_tag category;
typedef Category category;
BOOST_STATIC_ASSERT((!result_of::equal_to<first_type, last_type>::value));
joint_view_iterator(First const& first, Concat const& concat)

View 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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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>