diff --git a/include/boost/fusion/algorithm/iteration/accumulate.hpp b/include/boost/fusion/algorithm/iteration/accumulate.hpp index aa52a99b..b4d1e276 100644 --- a/include/boost/fusion/algorithm/iteration/accumulate.hpp +++ b/include/boost/fusion/algorithm/iteration/accumulate.hpp @@ -7,6 +7,7 @@ #if !defined(FUSION_ACCUMULATE_09172005_1032) #define FUSION_ACCUMULATE_09172005_1032 +#include #include namespace boost { namespace fusion diff --git a/include/boost/fusion/algorithm/iteration/accumulate_fwd.hpp b/include/boost/fusion/algorithm/iteration/accumulate_fwd.hpp new file mode 100644 index 00000000..9c0bd115 --- /dev/null +++ b/include/boost/fusion/algorithm/iteration/accumulate_fwd.hpp @@ -0,0 +1,28 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_ACCUMULATE_FWD_HPP_INCLUDED) +#define BOOST_FUSION_ACCUMULATE_FWD_HPP_INCLUDED + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct accumulate; + } + + template + typename result_of::accumulate::type + accumulate(Sequence& seq, State const& state, F f); + + template + typename result_of::accumulate::type + accumulate(Sequence const& seq, State const& state, F f); +}} + +#endif + diff --git a/include/boost/fusion/algorithm/iteration/detail/fold.hpp b/include/boost/fusion/algorithm/iteration/detail/fold.hpp index 56302fb8..69d436df 100644 --- a/include/boost/fusion/algorithm/iteration/detail/fold.hpp +++ b/include/boost/fusion/algorithm/iteration/detail/fold.hpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -347,53 +348,73 @@ namespace boost { namespace fusion type; }; - template + template struct BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME,_impl) { typedef typename BOOST_PP_CAT( result_of_first_unrolled,BOOST_FUSION_FOLD_NAME)< StateRef - , BOOST_FUSION_FOLD_IMPL_FIRST_IT_META_TRANSFORM(It0) + , BOOST_FUSION_FOLD_IMPL_FIRST_IT_META_TRANSFORM( + typename result_of::BOOST_FUSION_FOLD_IMPL_FIRST_IT_FUNCTION::type + ) , F , SeqSize >::type type; static type - call(StateRef state, It0 const& it0, F f) + call(StateRef state, Seq& seq, F f) { - return BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME)< - type - , SeqSize - >::call(state,BOOST_FUSION_FOLD_IMPL_FIRST_IT_TRANSFORM(it0),f); + typedef + BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME)< + type + , SeqSize + > + unrolled_impl; + + return unrolled_impl::call( + state, + BOOST_FUSION_FOLD_IMPL_FIRST_IT_TRANSFORM( + fusion::BOOST_FUSION_FOLD_IMPL_FIRST_IT_FUNCTION(seq)), + f); } }; - template - struct BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME,_impl)<0,StateRef,It0,F> + template + struct BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME,_impl)<0,StateRef,Seq,F> { typedef StateRef type; static StateRef - call(StateRef state, It0 const&, F) + call(StateRef state, Seq&, F) { return static_cast(state); } }; + + template + struct BOOST_PP_CAT(result_of_, BOOST_FUSION_FOLD_NAME) + : BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME,_impl)< + result_of::size::value + , typename add_reference< + typename add_const::type + >::type + , Seq + , F + > + {}; } namespace result_of { template struct BOOST_FUSION_FOLD_NAME - : detail::BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME,_impl)< - size::value - , typename add_reference< - typename add_const::type - >::type - , typename BOOST_FUSION_FOLD_IMPL_FIRST_IT_FUNCTION::type + : detail::BOOST_PP_CAT(result_of_, BOOST_FUSION_FOLD_NAME)< + Seq + , State , F + , traits::is_segmented::type::value > {}; } @@ -408,7 +429,7 @@ namespace boost { namespace fusion { return result_of::BOOST_FUSION_FOLD_NAME::call( state, - fusion::BOOST_FUSION_FOLD_IMPL_FIRST_IT_FUNCTION(seq), + seq, f); } @@ -422,7 +443,35 @@ namespace boost { namespace fusion { return result_of::BOOST_FUSION_FOLD_NAME::call( state, - fusion::BOOST_FUSION_FOLD_IMPL_FIRST_IT_FUNCTION(seq), + seq, + f); + } + + template + inline typename result_of::BOOST_FUSION_FOLD_NAME< + Seq + , State const + , F + >::type + BOOST_FUSION_FOLD_NAME(Seq& seq, State& state, F f) + { + return result_of::BOOST_FUSION_FOLD_NAME::call( + state, + seq, + f); + } + + template + inline typename result_of::BOOST_FUSION_FOLD_NAME< + Seq const + , State const + , F + >::type + BOOST_FUSION_FOLD_NAME(Seq const& seq, State& state, F f) + { + return result_of::BOOST_FUSION_FOLD_NAME::call( + state, + seq, f); } }} diff --git a/include/boost/fusion/algorithm/iteration/detail/for_each.hpp b/include/boost/fusion/algorithm/iteration/detail/for_each.hpp index a23517c8..f2fcc4e7 100644 --- a/include/boost/fusion/algorithm/iteration/detail/for_each.hpp +++ b/include/boost/fusion/algorithm/iteration/detail/for_each.hpp @@ -13,6 +13,7 @@ #include #include #include +#include #include namespace boost { namespace fusion { @@ -36,7 +37,7 @@ namespace detail template inline void - for_each(Sequence& seq, F const& f, Tag) + for_each_dispatch(Sequence& seq, F const& f, Tag) { detail::for_each_linear( fusion::begin(seq) @@ -117,12 +118,19 @@ namespace detail template inline void - for_each(Sequence& seq, F const& f, random_access_traversal_tag) + for_each_dispatch(Sequence& seq, F const& f, random_access_traversal_tag) { typedef typename result_of::begin::type begin; typedef typename result_of::end::type end; for_each_unrolled::type::value>::call(fusion::begin(seq), f); } + + template + inline void + for_each(Sequence& seq, F const& f, mpl::false_) // unsegmented implementation + { + detail::for_each_dispatch(seq, f, typename traits::category_of::type()); + } }}} diff --git a/include/boost/fusion/algorithm/iteration/detail/segmented_fold.hpp b/include/boost/fusion/algorithm/iteration/detail/segmented_fold.hpp new file mode 100644 index 00000000..2371e189 --- /dev/null +++ b/include/boost/fusion/algorithm/iteration/detail/segmented_fold.hpp @@ -0,0 +1,59 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_FOLD_S_HPP_INCLUDED) +#define BOOST_FUSION_FOLD_S_HPP_INCLUDED + +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + template + struct segmented_fold_fun + { + explicit segmented_fold_fun(Fun const& f) + : fun(f) + {} + + Fun const& fun; + + template + struct apply + { + typedef typename result_of::fold::type type; + typedef mpl::true_ continue_type; + + static type call(Sequence& seq, State const& state, Context const&, segmented_fold_fun const& fun) + { + return fusion::fold(seq, state, fun.fun); + } + }; + }; + + // The default implementation of this lives in detail/fold.hpp + template + struct result_of_fold; + + template + struct result_of_fold + { + typedef + typename result_of::segmented_fold_until< + Sequence, + State, + segmented_fold_fun + >::type + type; + + static type call(State& state, Sequence& seq, Fun fun) + { + return fusion::segmented_fold_until(seq, state, segmented_fold_fun(fun)); + } + }; +}}} + +#endif diff --git a/include/boost/fusion/algorithm/iteration/detail/segmented_for_each.hpp b/include/boost/fusion/algorithm/iteration/detail/segmented_for_each.hpp new file mode 100644 index 00000000..f7ffb24d --- /dev/null +++ b/include/boost/fusion/algorithm/iteration/detail/segmented_for_each.hpp @@ -0,0 +1,48 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_SEGMENTED_FOR_EACH_HPP_INCLUDED) +#define BOOST_FUSION_SEGMENTED_FOR_EACH_HPP_INCLUDED + +#include +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + template + struct segmented_for_each_fun + { + explicit segmented_for_each_fun(Fun const& f) + : fun(f) + {} + + Fun const& fun; + + template + struct apply + { + typedef void_ type; + typedef mpl::true_ continue_type; + + static type call(Sequence& seq, State const&, Context const&, segmented_for_each_fun const& fun) + { + fusion::for_each(seq, fun.fun); + return void_(); + } + }; + }; + + template + inline void + for_each(Sequence& seq, F const& f, mpl::true_) // segmented implementation + { + fusion::segmented_fold_until(seq, void_(), segmented_for_each_fun(f)); + } +}}} + +#endif diff --git a/include/boost/fusion/algorithm/iteration/ext_/for_each_s.hpp b/include/boost/fusion/algorithm/iteration/ext_/for_each_s.hpp deleted file mode 100755 index 9e571d0f..00000000 --- a/include/boost/fusion/algorithm/iteration/ext_/for_each_s.hpp +++ /dev/null @@ -1,91 +0,0 @@ -/*============================================================================= - Copyright (c) 2006 Eric Niebler - - 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(FUSION_FOR_EACH_S_05022006_1027) -#define FUSION_FOR_EACH_S_05022006_1027 - -#include -#include -#include -#include -#include - -// fwd declarations -namespace boost { namespace fusion -{ - template - void - for_each_s(Sequence& seq, F const& f); - - template - void - for_each_s(Sequence const& seq, F const& f); -}} - -namespace boost { namespace fusion { namespace detail -{ - template - struct for_each_s_bind - { - explicit for_each_s_bind(F const &f) - : f_(f) - {} - - template - void operator ()(Sequence &seq) const - { - fusion::for_each_s(seq, this->f_); - } - - template - void operator ()(Sequence const &seq) const - { - fusion::for_each_s(seq, this->f_); - } - private: - F const &f_; - }; - - template - void for_each_s(Sequence &seq, F const &f, mpl::true_) - { - fusion::for_each_s(fusion::segments(seq), for_each_s_bind(f)); - } - - template - void for_each_s(Sequence &seq, F const &f, mpl::false_) - { - fusion::for_each(seq, f); - } -}}} - -namespace boost { namespace fusion -{ - namespace result_of - { - template - struct for_each_s - { - typedef void type; - }; - } - - template - inline void - for_each_s(Sequence& seq, F const& f) - { - detail::for_each_s(seq, f, traits::is_segmented()); - } - - template - inline void - for_each_s(Sequence const& seq, F const& f) - { - detail::for_each_s(seq, f, traits::is_segmented()); - } -}} - -#endif diff --git a/include/boost/fusion/algorithm/iteration/fold.hpp b/include/boost/fusion/algorithm/iteration/fold.hpp index 347fb4f1..4b9d7d46 100644 --- a/include/boost/fusion/algorithm/iteration/fold.hpp +++ b/include/boost/fusion/algorithm/iteration/fold.hpp @@ -10,6 +10,8 @@ #ifndef BOOST_FUSION_ALGORITHM_ITERATION_FOLD_HPP #define BOOST_FUSION_ALGORITHM_ITERATION_FOLD_HPP +#include #include +#include #endif diff --git a/include/boost/fusion/algorithm/iteration/fold_fwd.hpp b/include/boost/fusion/algorithm/iteration/fold_fwd.hpp new file mode 100644 index 00000000..edb43e01 --- /dev/null +++ b/include/boost/fusion/algorithm/iteration/fold_fwd.hpp @@ -0,0 +1,52 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_ALGORITHM_ITERATION_FOLD_FWD_HPP +#define BOOST_FUSION_ALGORITHM_ITERATION_FOLD_FWD_HPP + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct fold; + } + + template + typename result_of::fold< + Seq + , State const + , F + >::type + fold(Seq& seq, State const& state, F f); + + template + typename result_of::fold< + Seq const + , State const + , F + >::type + fold(Seq const& seq, State const& state, F f); + + template + typename result_of::fold< + Seq + , State const + , F + >::type + fold(Seq& seq, State& state, F f); + + template + typename result_of::fold< + Seq const + , State const + , F + >::type + fold(Seq const& seq, State& state, F f); +}} + +#endif diff --git a/include/boost/fusion/algorithm/iteration/for_each.hpp b/include/boost/fusion/algorithm/iteration/for_each.hpp index fffb0f00..ab8b8f0e 100644 --- a/include/boost/fusion/algorithm/iteration/for_each.hpp +++ b/include/boost/fusion/algorithm/iteration/for_each.hpp @@ -9,11 +9,11 @@ #define BOOST_FUSION_FOR_EACH_20070527_0943 #include +#include +#include -#include - -namespace boost { namespace fusion { - +namespace boost { namespace fusion +{ namespace result_of { template @@ -23,20 +23,18 @@ namespace boost { namespace fusion { }; } - struct random_access_traversal_tag; - template inline void for_each(Sequence& seq, F const& f) { - detail::for_each(seq, f, typename traits::category_of::type()); + detail::for_each(seq, f, typename traits::is_segmented::type()); } template inline void for_each(Sequence const& seq, F const& f) { - detail::for_each(seq, f, typename traits::category_of::type()); + detail::for_each(seq, f, typename traits::is_segmented::type()); } }} diff --git a/include/boost/fusion/algorithm/iteration/for_each_fwd.hpp b/include/boost/fusion/algorithm/iteration/for_each_fwd.hpp new file mode 100644 index 00000000..544915d9 --- /dev/null +++ b/include/boost/fusion/algorithm/iteration/for_each_fwd.hpp @@ -0,0 +1,27 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_FOR_EACH_FWD_HPP_INCLUDED) +#define BOOST_FUSION_FOR_EACH_FWD_HPP_INCLUDED + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct for_each; + } + + template + void + for_each(Sequence& seq, F const& f); + + template + void + for_each(Sequence const& seq, F const& f); +}} + +#endif diff --git a/include/boost/fusion/algorithm/iteration/iter_fold.hpp b/include/boost/fusion/algorithm/iteration/iter_fold.hpp index 59cbfd8c..722d6ef8 100644 --- a/include/boost/fusion/algorithm/iteration/iter_fold.hpp +++ b/include/boost/fusion/algorithm/iteration/iter_fold.hpp @@ -10,6 +10,7 @@ #define BOOST_FUSION_ITER_FOLD +#include #include #undef BOOST_FUSION_ITER_FOLD diff --git a/include/boost/fusion/algorithm/iteration/iter_fold_fwd.hpp b/include/boost/fusion/algorithm/iteration/iter_fold_fwd.hpp new file mode 100644 index 00000000..96ff387d --- /dev/null +++ b/include/boost/fusion/algorithm/iteration/iter_fold_fwd.hpp @@ -0,0 +1,52 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_ALGORITHM_ITERATION_ITER_FOLD_FWD_HPP +#define BOOST_FUSION_ALGORITHM_ITERATION_ITER_FOLD_FWD_HPP + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct iter_fold; + } + + template + typename result_of::iter_fold< + Seq + , State const + , F + >::type + iter_fold(Seq& seq, State const& state, F f); + + template + typename result_of::iter_fold< + Seq const + , State const + , F + >::type + iter_fold(Seq const& seq, State const& state, F f); + + template + typename result_of::iter_fold< + Seq + , State const + , F + >::type + iter_fold(Seq& seq, State& state, F f); + + template + typename result_of::iter_fold< + Seq const + , State const + , F + >::type + iter_fold(Seq const& seq, State& state, F f); +}} + +#endif diff --git a/include/boost/fusion/algorithm/iteration/reverse_fold.hpp b/include/boost/fusion/algorithm/iteration/reverse_fold.hpp index bb09db5d..2ee4fd96 100644 --- a/include/boost/fusion/algorithm/iteration/reverse_fold.hpp +++ b/include/boost/fusion/algorithm/iteration/reverse_fold.hpp @@ -10,6 +10,7 @@ #define BOOST_FUSION_REVERSE_FOLD +#include #include #undef BOOST_FUSION_REVERSE_FOLD diff --git a/include/boost/fusion/algorithm/iteration/reverse_fold_fwd.hpp b/include/boost/fusion/algorithm/iteration/reverse_fold_fwd.hpp new file mode 100644 index 00000000..40546b53 --- /dev/null +++ b/include/boost/fusion/algorithm/iteration/reverse_fold_fwd.hpp @@ -0,0 +1,52 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_ALGORITHM_ITERATION_REVERSE_FOLD_FWD_HPP +#define BOOST_FUSION_ALGORITHM_ITERATION_REVERSE_FOLD_FWD_HPP + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct reverse_fold; + } + + template + typename result_of::reverse_fold< + Seq + , State const + , F + >::type + reverse_fold(Seq& seq, State const& state, F f); + + template + typename result_of::reverse_fold< + Seq const + , State const + , F + >::type + reverse_fold(Seq const& seq, State const& state, F f); + + template + typename result_of::reverse_fold< + Seq + , State const + , F + >::type + reverse_fold(Seq& seq, State& state, F f); + + template + typename result_of::reverse_fold< + Seq const + , State const + , F + >::type + reverse_fold(Seq const& seq, State& state, F f); +}} + +#endif diff --git a/include/boost/fusion/algorithm/iteration/reverse_iter_fold.hpp b/include/boost/fusion/algorithm/iteration/reverse_iter_fold.hpp index 80079f48..2931301f 100644 --- a/include/boost/fusion/algorithm/iteration/reverse_iter_fold.hpp +++ b/include/boost/fusion/algorithm/iteration/reverse_iter_fold.hpp @@ -11,6 +11,7 @@ #define BOOST_FUSION_REVERSE_FOLD #define BOOST_FUSION_ITER_FOLD +#include #include #undef BOOST_FUSION_REVERSE_FOLD diff --git a/include/boost/fusion/algorithm/iteration/reverse_iter_fold_fwd.hpp b/include/boost/fusion/algorithm/iteration/reverse_iter_fold_fwd.hpp new file mode 100644 index 00000000..a28b4eec --- /dev/null +++ b/include/boost/fusion/algorithm/iteration/reverse_iter_fold_fwd.hpp @@ -0,0 +1,52 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_ALGORITHM_ITERATION_REVERSE_ITER_FOLD_FWD_HPP +#define BOOST_FUSION_ALGORITHM_ITERATION_REVERSE_ITER_FOLD_FWD_HPP + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct reverse_iter_fold; + } + + template + typename result_of::reverse_iter_fold< + Seq + , State const + , F + >::type + reverse_iter_fold(Seq& seq, State const& state, F f); + + template + typename result_of::reverse_iter_fold< + Seq const + , State const + , F + >::type + reverse_iter_fold(Seq const& seq, State const& state, F f); + + template + typename result_of::reverse_iter_fold< + Seq + , State const + , F + >::type + reverse_iter_fold(Seq& seq, State& state, F f); + + template + typename result_of::reverse_iter_fold< + Seq const + , State const + , F + >::type + reverse_iter_fold(Seq const& seq, State& state, F f); +}} + +#endif diff --git a/include/boost/fusion/algorithm/query/detail/find_if.hpp b/include/boost/fusion/algorithm/query/detail/find_if.hpp index 5d2a7419..db2c182a 100644 --- a/include/boost/fusion/algorithm/query/detail/find_if.hpp +++ b/include/boost/fusion/algorithm/query/detail/find_if.hpp @@ -9,19 +9,18 @@ #if !defined(FUSION_FIND_IF_05052005_1107) #define FUSION_FIND_IF_05052005_1107 -#include -#include -#include #include +#include #include +#include +#include +#include +#include #include #include #include -#include -#include +#include #include -#include -#include namespace boost { namespace fusion { struct random_access_traversal_tag; @@ -222,10 +221,31 @@ namespace detail template static type - call(Iterator const& iter) + iter_call(Iterator const& iter) { return choose_call(iter, typename traits::category_of::type()); } + + template + static type + call(Sequence& seq) + { + return iter_call(fusion::begin(seq)); + } + }; + + template + struct result_of_find_if + { + typedef + static_find_if< + typename result_of::begin::type + , typename result_of::end::type + , Pred + > + filter; + + typedef typename filter::type type; }; }}} diff --git a/include/boost/fusion/algorithm/query/detail/segmented_find.hpp b/include/boost/fusion/algorithm/query/detail/segmented_find.hpp new file mode 100644 index 00000000..ead57834 --- /dev/null +++ b/include/boost/fusion/algorithm/query/detail/segmented_find.hpp @@ -0,0 +1,90 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_SEGMENTED_FIND_HPP_INCLUDED) +#define BOOST_FUSION_SEGMENTED_FIND_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + template + struct segmented_find_fun + { + template + struct apply + { + typedef + typename result_of::find::type + iterator_type; + + typedef + typename result_of::equal_to< + iterator_type + , typename result_of::end::type + >::type + continue_type; + + typedef + typename mpl::eval_if< + continue_type + , mpl::identity + , result_of::make_segmented_iterator< + iterator_type + , Context + > + >::type + type; + + static type call(Sequence& seq, State const&state, Context const& context, segmented_find_fun) + { + return call_impl(seq, state, context, continue_type()); + } + + static type call_impl(Sequence&, State const&state, Context const&, mpl::true_) + { + return state; + } + + static type call_impl(Sequence& seq, State const&, Context const& context, mpl::false_) + { + return fusion::make_segmented_iterator(fusion::find(seq), context); + } + }; + }; + + template + struct result_of_segmented_find + { + struct filter + { + typedef + typename result_of::segmented_fold_until< + Sequence + , typename result_of::end::type + , segmented_find_fun + >::type + type; + + static type call(Sequence& seq) + { + return fusion::segmented_fold_until( + seq + , fusion::end(seq) + , detail::segmented_find_fun()); + } + }; + + typedef typename filter::type type; + }; +}}} + +#endif diff --git a/include/boost/fusion/algorithm/query/detail/segmented_find_if.hpp b/include/boost/fusion/algorithm/query/detail/segmented_find_if.hpp new file mode 100644 index 00000000..745edd2f --- /dev/null +++ b/include/boost/fusion/algorithm/query/detail/segmented_find_if.hpp @@ -0,0 +1,90 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_SEGMENTED_FIND_IF_HPP_INCLUDED) +#define BOOST_FUSION_SEGMENTED_FIND_IF_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + template + struct segmented_find_if_fun + { + template + struct apply + { + typedef + typename result_of::find_if::type + iterator_type; + + typedef + typename result_of::equal_to< + iterator_type + , typename result_of::end::type + >::type + continue_type; + + typedef + typename mpl::eval_if< + continue_type + , mpl::identity + , result_of::make_segmented_iterator< + iterator_type + , Context + > + >::type + type; + + static type call(Sequence& seq, State const&state, Context const& context, segmented_find_if_fun) + { + return call_impl(seq, state, context, continue_type()); + } + + static type call_impl(Sequence&, State const&state, Context const&, mpl::true_) + { + return state; + } + + static type call_impl(Sequence& seq, State const&, Context const& context, mpl::false_) + { + return fusion::make_segmented_iterator(fusion::find_if(seq), context); + } + }; + }; + + template + struct result_of_segmented_find_if + { + struct filter + { + typedef + typename result_of::segmented_fold_until< + Sequence + , typename result_of::end::type + , segmented_find_if_fun + >::type + type; + + static type call(Sequence& seq) + { + return fusion::segmented_fold_until( + seq + , fusion::end(seq) + , segmented_find_if_fun()); + } + }; + + typedef typename filter::type type; + }; +}}} + +#endif diff --git a/include/boost/fusion/algorithm/query/ext_/find_if_s.hpp b/include/boost/fusion/algorithm/query/ext_/find_if_s.hpp deleted file mode 100755 index 0b1852a6..00000000 --- a/include/boost/fusion/algorithm/query/ext_/find_if_s.hpp +++ /dev/null @@ -1,222 +0,0 @@ -/*============================================================================= - Copyright (c) 2006 Eric Niebler - - 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(FIND_IF_S_05152006_1027) -#define FIND_IF_S_05152006_1027 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// fwd declarations -namespace boost { namespace fusion -{ - namespace detail - { - template::value> - struct static_find_if_s_recurse; - } - - namespace result_of - { - template - struct find_if_s; - } -}} - -namespace boost { namespace fusion { namespace detail -{ - - template::value> - struct is_found - : mpl::not_::type> > - {}; - - template - struct is_found - : mpl::not_ > - {}; - - template< - typename SegmentedRange - , typename Where - , typename Sequence = typename remove_reference< - typename result_of::deref< - typename SegmentedRange::iterator_type - >::type - >::type - , bool IsSegmented = traits::is_segmented::value - > - struct as_segmented_cons - { - typedef cons< - SegmentedRange - , cons > - > type; - - static type call(SegmentedRange const &range, Where const &where) - { - return fusion::make_cons( - range - , fusion::make_cons( - segmented_range(*fusion::begin(range), where) - ) - ); - } - }; - - template< - typename SegmentedRange - , typename Where - , typename Sequence - > - struct as_segmented_cons - { - typedef cons type; - - static type call(SegmentedRange const &range, Where const &where) - { - return fusion::make_cons(range, where); - } - }; - - template< - typename SegmentedRange - , typename Pred - , bool IsEmpty = is_empty::value - > - struct static_find_if_s_seg - { - typedef typename SegmentedRange::iterator_type first; - typedef typename result_of::deref::type segment_ref; - typedef typename remove_reference::type segment; - typedef static_find_if_s_recurse where; - typedef range_next next; - typedef is_found is_found; - typedef as_segmented_cons found; - typedef static_find_if_s_seg not_found; - typedef typename mpl::eval_if::type type; - - static type call(SegmentedRange const &range) - { - return call_(range, is_found()); - } - - private: - static type call_(SegmentedRange const &range, mpl::true_) - { - return found::call(range, where::call(*range.where_)); - } - - static type call_(SegmentedRange const &range, mpl::false_) - { - return not_found::call(next::call(range)); - } - }; - - template< - typename SegmentedRange - , typename Pred - > - struct static_find_if_s_seg - { - typedef nil type; - - static type call(SegmentedRange const &) - { - return nil(); - } - }; - - template - struct static_find_if_s_recurse - { - typedef typename as_segmented_range::type range; - typedef static_find_if_s_seg find_if; - typedef typename find_if::type type; - - static type call(Sequence &seq) - { - return find_if::call(range(fusion::segments(seq))); - } - }; - - template - struct static_find_if_s_recurse - { - typedef typename result_of::find_if::type type; - - static type call(Sequence &seq) - { - return fusion::find_if(seq); - } - }; - - template::value> - struct static_find_if_s - : static_find_if_s_recurse - {}; - - template - struct static_find_if_s - { - typedef typename as_segmented_range::type range; - typedef static_find_if_s_recurse find_if; - typedef typename find_if::type found; - - typedef segmented_iterator::type> type; - - static type call(Sequence &seq) - { - return type(reverse_cons::call(find_if::call(seq))); - } - }; -}}} - -namespace boost { namespace fusion -{ - namespace result_of - { - template - struct find_if_s - { - typedef typename - detail::static_find_if_s< - Sequence - , Pred - >::type - type; - }; - } - - template - typename lazy_disable_if< - is_const - , result_of::find_if_s - >::type - find_if_s(Sequence& seq) - { - return detail::static_find_if_s::call(seq); - } - - template - typename result_of::find_if_s::type - find_if_s(Sequence const& seq) - { - return detail::static_find_if_s::call(seq); - } -}} - -#endif diff --git a/include/boost/fusion/algorithm/query/find.hpp b/include/boost/fusion/algorithm/query/find.hpp index 6beb9005..7b089c96 100644 --- a/include/boost/fusion/algorithm/query/find.hpp +++ b/include/boost/fusion/algorithm/query/find.hpp @@ -1,5 +1,6 @@ /*============================================================================= Copyright (c) 2001-2006 Joel de Guzman + Copyright (c) 2011 Eric Niebler 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) @@ -7,13 +8,15 @@ #if !defined(FUSION_FIND_05052005_1107) #define FUSION_FIND_05052005_1107 +#include #include -#include -#include +#include #include #include #include +#include #include +#include #include #include #include @@ -22,17 +25,14 @@ namespace boost { namespace fusion { namespace result_of { - template < - typename Sequence - , typename T - > + template struct find - { - typedef - detail::static_find_if< - typename result_of::begin::type - , typename result_of::end::type - , is_same< + : mpl::if_< + traits::is_segmented + , detail::result_of_segmented_find + , detail::result_of_find_if< + Sequence, + is_same< typename mpl::if_< traits::is_associative , key_of @@ -41,10 +41,8 @@ namespace boost { namespace fusion , T > > - filter; - - typedef typename filter::type type; - }; + >::type + {}; } template @@ -56,7 +54,7 @@ namespace boost { namespace fusion find(Sequence& seq) { typedef typename result_of::find::filter filter; - return filter::call(fusion::begin(seq)); + return filter::call(seq); } template @@ -64,9 +62,8 @@ namespace boost { namespace fusion find(Sequence const& seq) { typedef typename result_of::find::filter filter; - return filter::call(fusion::begin(seq)); + return filter::call(seq); } }} #endif - diff --git a/include/boost/fusion/algorithm/query/find_fwd.hpp b/include/boost/fusion/algorithm/query/find_fwd.hpp new file mode 100644 index 00000000..96d989a4 --- /dev/null +++ b/include/boost/fusion/algorithm/query/find_fwd.hpp @@ -0,0 +1,34 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_FIND_FWD_HPP_INCLUDED) +#define BOOST_FUSION_FIND_FWD_HPP_INCLUDED + +#include +#include + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct find; + } + + template + inline typename + lazy_disable_if< + is_const + , result_of::find + >::type const + find(Sequence& seq); + + template + inline typename result_of::find::type const + find(Sequence const& seq); +}} + +#endif diff --git a/include/boost/fusion/algorithm/query/find_if.hpp b/include/boost/fusion/algorithm/query/find_if.hpp index 3950958c..5f0e64d8 100644 --- a/include/boost/fusion/algorithm/query/find_if.hpp +++ b/include/boost/fusion/algorithm/query/find_if.hpp @@ -1,5 +1,6 @@ /*============================================================================= Copyright (c) 2001-2006 Joel de Guzman + Copyright (c) 2011 Eric Niebler 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) @@ -7,15 +8,17 @@ #if !defined(FUSION_FIND_IF_05052005_1108) #define FUSION_FIND_IF_05052005_1108 +#include #include -#include -#include +#include #include -#include -#include -#include +#include #include #include +#include +#include +#include +#include namespace boost { namespace fusion { @@ -23,20 +26,18 @@ namespace boost { namespace fusion { template struct find_if - { - typedef - detail::static_find_if< - typename result_of::begin::type - , typename result_of::end::type - , mpl::bind1< + : mpl::if_< + traits::is_segmented + , detail::result_of_segmented_find_if + , detail::result_of_find_if< + Sequence, + mpl::bind1< typename mpl::lambda::type - , mpl::bind1,mpl::_1> + , mpl::bind1, mpl::_1> > > - filter; - - typedef typename filter::type type; - }; + >::type + {}; } template @@ -48,7 +49,7 @@ namespace boost { namespace fusion find_if(Sequence& seq) { typedef typename result_of::find_if::filter filter; - return filter::call(fusion::begin(seq)); + return filter::call(seq); } template @@ -56,9 +57,8 @@ namespace boost { namespace fusion find_if(Sequence const& seq) { typedef typename result_of::find_if::filter filter; - return filter::call(fusion::begin(seq)); + return filter::call(seq); } }} #endif - diff --git a/include/boost/fusion/algorithm/query/find_if_fwd.hpp b/include/boost/fusion/algorithm/query/find_if_fwd.hpp new file mode 100644 index 00000000..adb8f2de --- /dev/null +++ b/include/boost/fusion/algorithm/query/find_if_fwd.hpp @@ -0,0 +1,35 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_FIND_IF_FWD_HPP_INCLUDED) +#define BOOST_FUSION_FIND_IF_FWD_HPP_INCLUDED + +#include +#include + +// Forward declaration of find_if algorithm +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct find_if; + } + + template + typename + lazy_disable_if< + is_const + , result_of::find_if + >::type + find_if(Sequence& seq); + + template + typename result_of::find_if::type const + find_if(Sequence const& seq); +}} + +#endif diff --git a/include/boost/fusion/container/list/cons.hpp b/include/boost/fusion/container/list/cons.hpp index e2745616..4ffd0a7b 100644 --- a/include/boost/fusion/container/list/cons.hpp +++ b/include/boost/fusion/container/list/cons.hpp @@ -8,6 +8,7 @@ #if !defined(FUSION_CONS_07172005_0843) #define FUSION_CONS_07172005_0843 +#include #include #include #include @@ -55,7 +56,7 @@ namespace boost { namespace fusion } }; - template + template struct cons : sequence_base > { typedef mpl::int_ size; diff --git a/include/boost/fusion/container/list/cons_fwd.hpp b/include/boost/fusion/container/list/cons_fwd.hpp new file mode 100644 index 00000000..cbbe4be6 --- /dev/null +++ b/include/boost/fusion/container/list/cons_fwd.hpp @@ -0,0 +1,20 @@ +/*============================================================================= + Copyright (c) 2005 Joel de Guzman + Copyright (c) 2005 Eric Niebler + + 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_CONS_FWD_HPP_INCLUDED) +#define BOOST_FUSION_CONS_FWD_HPP_INCLUDED + +namespace boost { namespace fusion +{ + struct nil; + + template + struct cons; +}} + +#endif + diff --git a/include/boost/fusion/container/list/detail/reverse_cons.hpp b/include/boost/fusion/container/list/detail/reverse_cons.hpp new file mode 100644 index 00000000..59178e84 --- /dev/null +++ b/include/boost/fusion/container/list/detail/reverse_cons.hpp @@ -0,0 +1,43 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_REVERSE_CONS_HPP_INCLUDED) +#define BOOST_FUSION_REVERSE_CONS_HPP_INCLUDED + +#include + +namespace boost { namespace fusion { namespace detail +{ + //////////////////////////////////////////////////////////////////////////// + template + struct reverse_cons; + + template + struct reverse_cons, State> + { + typedef reverse_cons > impl; + typedef typename impl::type type; + + static type call(cons const &cons, State const &state = State()) + { + typedef fusion::cons cdr_type; + return impl::call(cons.cdr, cdr_type(cons.car, state)); + } + }; + + template + struct reverse_cons + { + typedef State type; + + static State const &call(nil const &, State const &state = State()) + { + return state; + } + }; +}}} + +#endif diff --git a/include/boost/fusion/container/vector/vector10.hpp b/include/boost/fusion/container/vector/vector10.hpp index f1af70d7..57dee09e 100644 --- a/include/boost/fusion/container/vector/vector10.hpp +++ b/include/boost/fusion/container/vector/vector10.hpp @@ -7,6 +7,7 @@ #if !defined(FUSION_VECTOR10_05042005_0257) #define FUSION_VECTOR10_05042005_0257 +#include #include #include #include @@ -39,7 +40,7 @@ namespace boost { namespace fusion struct fusion_sequence_tag; struct random_access_traversal_tag; - template + template struct vector0 : sequence_base > { typedef mpl::vector0<> types; diff --git a/include/boost/fusion/container/vector/vector10_fwd.hpp b/include/boost/fusion/container/vector/vector10_fwd.hpp new file mode 100644 index 00000000..b656cea4 --- /dev/null +++ b/include/boost/fusion/container/vector/vector10_fwd.hpp @@ -0,0 +1,34 @@ +#ifndef BOOST_PP_IS_ITERATING +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_VECTOR10_FWD_HPP_INCLUDED) +#define BOOST_FUSION_VECTOR10_FWD_HPP_INCLUDED + +#include +#include +#include + +namespace boost { namespace fusion +{ + template + struct vector0; + + // expand vector1 to vector10 + #define BOOST_PP_FILENAME_1 + #define BOOST_PP_ITERATION_LIMITS (1, 10) + #include BOOST_PP_ITERATE() + +}} + +#endif + +#else + + template + struct BOOST_PP_CAT(vector, BOOST_PP_ITERATION()); + +#endif diff --git a/include/boost/fusion/container/vector/vector20.hpp b/include/boost/fusion/container/vector/vector20.hpp index be711006..06649840 100644 --- a/include/boost/fusion/container/vector/vector20.hpp +++ b/include/boost/fusion/container/vector/vector20.hpp @@ -7,6 +7,7 @@ #if !defined(FUSION_VECTOR20_05052005_0205) #define FUSION_VECTOR20_05052005_0205 +#include #include #include #include diff --git a/include/boost/fusion/container/vector/vector20_fwd.hpp b/include/boost/fusion/container/vector/vector20_fwd.hpp new file mode 100644 index 00000000..982911eb --- /dev/null +++ b/include/boost/fusion/container/vector/vector20_fwd.hpp @@ -0,0 +1,31 @@ +#ifndef BOOST_PP_IS_ITERATING +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_VECTOR20_FWD_HPP_INCLUDED) +#define BOOST_FUSION_VECTOR20_FWD_HPP_INCLUDED + +#include +#include +#include + +namespace boost { namespace fusion +{ + // expand vector11 to vector20 + #define BOOST_PP_FILENAME_1 + #define BOOST_PP_ITERATION_LIMITS (11, 20) + #include BOOST_PP_ITERATE() + +}} + +#endif + +#else + + template + struct BOOST_PP_CAT(vector, BOOST_PP_ITERATION()); + +#endif diff --git a/include/boost/fusion/container/vector/vector30.hpp b/include/boost/fusion/container/vector/vector30.hpp index efbe9293..d6614b14 100644 --- a/include/boost/fusion/container/vector/vector30.hpp +++ b/include/boost/fusion/container/vector/vector30.hpp @@ -7,6 +7,7 @@ #if !defined(FUSION_VECTOR30_05052005_0206) #define FUSION_VECTOR30_05052005_0206 +#include #include #include #include diff --git a/include/boost/fusion/container/vector/vector30_fwd.hpp b/include/boost/fusion/container/vector/vector30_fwd.hpp new file mode 100644 index 00000000..5458b7d4 --- /dev/null +++ b/include/boost/fusion/container/vector/vector30_fwd.hpp @@ -0,0 +1,31 @@ +#ifndef BOOST_PP_IS_ITERATING +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_VECTOR30_FWD_HPP_INCLUDED) +#define BOOST_FUSION_VECTOR30_FWD_HPP_INCLUDED + +#include +#include +#include + +namespace boost { namespace fusion +{ + // expand vector21 to vector30 + #define BOOST_PP_FILENAME_1 + #define BOOST_PP_ITERATION_LIMITS (21, 30) + #include BOOST_PP_ITERATE() + +}} + +#endif + +#else + + template + struct BOOST_PP_CAT(vector, BOOST_PP_ITERATION()); + +#endif diff --git a/include/boost/fusion/container/vector/vector40.hpp b/include/boost/fusion/container/vector/vector40.hpp index b72a23c5..eb965f69 100644 --- a/include/boost/fusion/container/vector/vector40.hpp +++ b/include/boost/fusion/container/vector/vector40.hpp @@ -7,6 +7,7 @@ #if !defined(FUSION_VECTOR40_05052005_0208) #define FUSION_VECTOR40_05052005_0208 +#include #include #include #include diff --git a/include/boost/fusion/container/vector/vector40_fwd.hpp b/include/boost/fusion/container/vector/vector40_fwd.hpp new file mode 100644 index 00000000..e7b4251d --- /dev/null +++ b/include/boost/fusion/container/vector/vector40_fwd.hpp @@ -0,0 +1,31 @@ +#ifndef BOOST_PP_IS_ITERATING +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_VECTOR40_FWD_HPP_INCLUDED) +#define BOOST_FUSION_VECTOR40_FWD_HPP_INCLUDED + +#include +#include +#include + +namespace boost { namespace fusion +{ + // expand vector31 to vector40 + #define BOOST_PP_FILENAME_1 + #define BOOST_PP_ITERATION_LIMITS (31, 40) + #include BOOST_PP_ITERATE() + +}} + +#endif + +#else + + template + struct BOOST_PP_CAT(vector, BOOST_PP_ITERATION()); + +#endif diff --git a/include/boost/fusion/container/vector/vector50.hpp b/include/boost/fusion/container/vector/vector50.hpp index ab8515d7..506e1a0a 100644 --- a/include/boost/fusion/container/vector/vector50.hpp +++ b/include/boost/fusion/container/vector/vector50.hpp @@ -7,6 +7,7 @@ #if !defined(FUSION_VECTOR50_05052005_0207) #define FUSION_VECTOR50_05052005_0207 +#include #include #include #include diff --git a/include/boost/fusion/container/vector/vector50_fwd.hpp b/include/boost/fusion/container/vector/vector50_fwd.hpp new file mode 100644 index 00000000..58f68e07 --- /dev/null +++ b/include/boost/fusion/container/vector/vector50_fwd.hpp @@ -0,0 +1,31 @@ +#ifndef BOOST_PP_IS_ITERATING +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_VECTOR50_FWD_HPP_INCLUDED) +#define BOOST_FUSION_VECTOR50_FWD_HPP_INCLUDED + +#include +#include +#include + +namespace boost { namespace fusion +{ + // expand vector41 to vector50 + #define BOOST_PP_FILENAME_1 + #define BOOST_PP_ITERATION_LIMITS (41, 50) + #include BOOST_PP_ITERATE() + +}} + +#endif + +#else + + template + struct BOOST_PP_CAT(vector, BOOST_PP_ITERATION()); + +#endif diff --git a/include/boost/fusion/container/vector/vector_fwd.hpp b/include/boost/fusion/container/vector/vector_fwd.hpp index 2c4848db..903cda17 100644 --- a/include/boost/fusion/container/vector/vector_fwd.hpp +++ b/include/boost/fusion/container/vector/vector_fwd.hpp @@ -10,6 +10,11 @@ #include #include +#include +#include +#include +#include +#include namespace boost { namespace fusion { diff --git a/include/boost/fusion/include/is_segmented.hpp b/include/boost/fusion/include/is_segmented.hpp new file mode 100644 index 00000000..28fa4346 --- /dev/null +++ b/include/boost/fusion/include/is_segmented.hpp @@ -0,0 +1,12 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_INCLUDE_IS_SEGMENTED) +#define BOOST_FUSION_INCLUDE_IS_SEGMENTED + +#include + +#endif diff --git a/include/boost/fusion/include/segmented_fold_until.hpp b/include/boost/fusion/include/segmented_fold_until.hpp new file mode 100644 index 00000000..d7fe06af --- /dev/null +++ b/include/boost/fusion/include/segmented_fold_until.hpp @@ -0,0 +1,12 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_INCLUDE_SEGMENTED_FOLD_UNTIL) +#define BOOST_FUSION_INCLUDE_SEGMENTED_FOLD_UNTIL + +#include + +#endif diff --git a/include/boost/fusion/include/segmented_iterator.hpp b/include/boost/fusion/include/segmented_iterator.hpp new file mode 100644 index 00000000..6e8a4964 --- /dev/null +++ b/include/boost/fusion/include/segmented_iterator.hpp @@ -0,0 +1,12 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_INCLUDE_SEGMENTED_ITERATOR) +#define BOOST_FUSION_INCLUDE_SEGMENTED_ITERATOR + +#include + +#endif diff --git a/include/boost/fusion/include/segments.hpp b/include/boost/fusion/include/segments.hpp new file mode 100644 index 00000000..7bc7b2bf --- /dev/null +++ b/include/boost/fusion/include/segments.hpp @@ -0,0 +1,12 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_INCLUDE_SEGMENTS) +#define BOOST_FUSION_INCLUDE_SEGMENTS + +#include + +#endif diff --git a/include/boost/fusion/iterator.hpp b/include/boost/fusion/iterator.hpp index c7f8e1eb..701fdb2a 100644 --- a/include/boost/fusion/iterator.hpp +++ b/include/boost/fusion/iterator.hpp @@ -8,6 +8,7 @@ #define FUSION_ITERATOR_10022005_0559 #include +#include #include #include #include diff --git a/include/boost/fusion/iterator/detail/segment_sequence.hpp b/include/boost/fusion/iterator/detail/segment_sequence.hpp new file mode 100644 index 00000000..c372a836 --- /dev/null +++ b/include/boost/fusion/iterator/detail/segment_sequence.hpp @@ -0,0 +1,71 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_SEGMENTED_SEQUENCE_HPP_INCLUDED) +#define BOOST_FUSION_SEGMENTED_SEQUENCE_HPP_INCLUDED + +#include +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + struct segment_sequence_tag {}; + + // Here, Sequence is a sequence of ranges (which may or may not be + // segmented). + template + struct segment_sequence + : sequence_base > + { + typedef fusion_sequence_tag tag; + typedef segment_sequence_tag fusion_tag; + typedef typename Sequence::is_view is_view; + typedef typename Sequence::category category; + typedef Sequence sequence_type; + sequence_type sequence; + + explicit segment_sequence(Sequence const & seq) + : sequence(seq) + {} + }; +} + +namespace extension +{ + template + struct is_segmented_impl; + + template<> + struct is_segmented_impl + { + template + struct apply + : mpl::true_ + {}; + }; + + template + struct segments_impl; + + template<> + struct segments_impl + { + template + struct apply + { + typedef typename Sequence::sequence_type type; + + static type call(Sequence & seq) + { + return seq.sequence; + } + }; + }; +}}} + +#endif diff --git a/include/boost/fusion/iterator/detail/segmented_equal_to.hpp b/include/boost/fusion/iterator/detail/segmented_equal_to.hpp new file mode 100644 index 00000000..1e4ad268 --- /dev/null +++ b/include/boost/fusion/iterator/detail/segmented_equal_to.hpp @@ -0,0 +1,41 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_SEGMENTED_ITERATOR_EQUAL_TO_HPP_INCLUDED) +#define BOOST_FUSION_SEGMENTED_ITERATOR_EQUAL_TO_HPP_INCLUDED + +#include +#include +#include + +namespace boost { namespace fusion +{ + struct nil; + + namespace detail + { + template + struct segmented_equal_to + : mpl::and_< + segmented_equal_to< + typename Stack1::cdr_type, + typename Stack2::cdr_type + > + , result_of::equal_to< + typename Stack1::car_type::begin_type, + typename Stack2::car_type::begin_type + > + > + {}; + + template <> + struct segmented_equal_to + : mpl::true_ + {}; + } +}} + +#endif diff --git a/include/boost/fusion/iterator/detail/segmented_iterator.hpp b/include/boost/fusion/iterator/detail/segmented_iterator.hpp new file mode 100644 index 00000000..ccd45fbf --- /dev/null +++ b/include/boost/fusion/iterator/detail/segmented_iterator.hpp @@ -0,0 +1,144 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_SEGMENTED_ITERATOR_SEGMENTED_ITERATOR_HPP_INCLUDED) +#define BOOST_FUSION_SEGMENTED_ITERATOR_SEGMENTED_ITERATOR_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct nil; + + namespace detail + { + template + struct segmented_next_impl; + } + + // A segmented iterator wraps a "context", which is a cons list + // of ranges, the frontmost is range over values and the rest + // are ranges over internal segments. + template + struct segmented_iterator + : iterator_facade, forward_traversal_tag> + { + explicit segmented_iterator(Context const& ctx) + : context(ctx) + {} + + //auto deref(it) + //{ + // return deref(begin(car(it.context))) + //} + template + struct deref + { + typedef + typename result_of::deref< + typename It::context_type::car_type::begin_type + >::type + type; + + static type call(It const& it) + { + return *it.context.car.first; + } + }; + + //auto deref_data(it) + //{ + // return deref_data(begin(car(it.context))) + //} + template + struct deref_data + { + typedef + typename result_of::deref_data< + typename It::context_type::car_type::begin_type + >::type + type; + + static type call(It const& it) + { + return fusion::deref_data(it.context.car.first); + } + }; + + //auto key_of(it) + //{ + // return key_of(begin(car(it.context))) + //} + template + struct key_of + : result_of::key_of + {}; + + //auto value_of(it) + //{ + // return value_of(begin(car(it.context))) + //} + template + struct value_of + : result_of::value_of + {}; + + //auto value_of_data(it) + //{ + // return value_of_data(begin(car(it.context))) + //} + template + struct value_of_data + : result_of::value_of_data + {}; + + // Compare all the segment iterators in each stack, starting with + // the bottom-most. + template < + typename It1 + , typename It2 + , int Size1 = It1::context_type::size::value + , int Size2 = It2::context_type::size::value + > + struct equal_to + : mpl::false_ + {}; + + template + struct equal_to + : detail::segmented_equal_to< + typename It1::context_type + , typename It2::context_type + > + {}; + + template + struct next + { + typedef detail::segmented_next_impl impl; + typedef segmented_iterator type; + + static type call(It const& it) + { + return type(impl::call(it.context)); + } + }; + + typedef Context context_type; + context_type context; + }; + +}} + +#endif diff --git a/include/boost/fusion/iterator/detail/segmented_next_impl.hpp b/include/boost/fusion/iterator/detail/segmented_next_impl.hpp new file mode 100644 index 00000000..2a7f6f6c --- /dev/null +++ b/include/boost/fusion/iterator/detail/segmented_next_impl.hpp @@ -0,0 +1,254 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_SEGMENTED_ITERATOR_NEXT_IMPL_HPP_INCLUDED) +#define BOOST_FUSION_SEGMENTED_ITERATOR_NEXT_IMPL_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + template + struct iterator_range; + + template + struct segmented_iterator; + + namespace detail + { + template + struct segmented_begin_impl; + + //bool is_invalid(stack) + //{ + // return empty(car(stack)); + //} + + template + struct is_invalid + : result_of::equal_to< + typename Stack::car_type::begin_type, + typename Stack::car_type::end_type + > + {}; + + ////Advance the first iterator in the seq at the + ////top of a stack of iterator ranges. Return the + ////new stack. + //auto pop_front_car(stack) + //{ + // return cons(iterator_range(next(begin(car(stack))), end(car(stack))), cdr(stack)); + //} + + template + struct pop_front_car + { + typedef + iterator_range< + typename result_of::next< + typename Stack::car_type::begin_type + >::type + , typename Stack::car_type::end_type + > + car_type; + + typedef + cons + type; + + static type call(Stack const & stack) + { + return type( + car_type(fusion::next(stack.car.first), stack.car.last), + stack.cdr); + } + }; + + template < + typename Stack, + typename Next = typename pop_front_car::type, + bool IsInvalid = is_invalid::value, + int StackSize = Stack::size::value> + struct segmented_next_impl_recurse; + + // Handle the case where the top of the stack has no usable + //auto segmented_next_impl_recurse3(stack) + //{ + // if (size(stack) == 1) + // return cons(iterator_range(end(car(stack)), end(car(stack))), nil); + // else + // return segmented_next_impl_recurse(stack.cdr); + //} + + template < + typename Stack, + int StackSize = Stack::size::value> + struct segmented_next_impl_recurse3 + { + typedef segmented_next_impl_recurse impl; + typedef typename impl::type type; + + static type call(Stack const & stack) + { + return impl::call(stack.cdr); + } + }; + + template + struct segmented_next_impl_recurse3 + { + typedef typename Stack::car_type::end_type end_type; + typedef iterator_range range_type; + typedef cons type; + + static type call(Stack const & stack) + { + return type(range_type(stack.car.last, stack.car.last)); + } + }; + + //auto segmented_next_impl_recurse2(stack) + //{ + // auto res = segmented_begin_impl(front(car(stack)), stack); + // if (is_invalid(res)) + // return segmented_next_impl_recurse3(stack); + // else + // return res; + //} + + template < + typename Stack, + typename Sequence = + typename remove_reference< + typename add_const< + typename result_of::deref< + typename Stack::car_type::begin_type + >::type + >::type + >::type, + typename Result = + typename segmented_begin_impl::type, + bool IsInvalid = + is_invalid::value> + struct segmented_next_impl_recurse2 + { + typedef segmented_next_impl_recurse3 impl; + typedef typename impl::type type; + + static type call(Stack const & stack) + { + return impl::call(stack); + } + }; + + template + struct segmented_next_impl_recurse2 + { + typedef Result type; + + static type call(Stack const & stack) + { + return segmented_begin_impl::call(*stack.car.first, stack); + } + }; + + //auto segmented_next_impl_recurse(stack) + //{ + // auto next = pop_front_car(stack); + // if (is_invalid(next)) + // if (1 == size(stack)) + // return next; + // else + // return segmented_next_impl_recurse(cdr(stack)); + // else + // return segmented_next_impl_recurse2(next) + //} + + template + struct segmented_next_impl_recurse + { + typedef + typename segmented_next_impl_recurse::type + type; + + static type call(Stack const& stack) + { + return segmented_next_impl_recurse::call(stack.cdr); + } + }; + + template + struct segmented_next_impl_recurse + { + typedef Next type; + + static type call(Stack const & stack) + { + return pop_front_car::call(stack); + } + }; + + template + struct segmented_next_impl_recurse + { + typedef segmented_next_impl_recurse2 impl; + typedef typename impl::type type; + + static type call(Stack const & stack) + { + return impl::call(pop_front_car::call(stack)); + } + }; + + //auto segmented_next_impl(stack) + //{ + // // car(stack) is a seq of values, not a seq of segments + // auto next = pop_front_car(stack); + // if (is_invalid(next)) + // return segmented_next_impl_recurse(cdr(next)); + // else + // return next; + //} + + template < + typename Stack, + typename Next = typename pop_front_car::type, + bool IsInvalid = is_invalid::value> + struct segmented_next_impl_aux + { + typedef segmented_next_impl_recurse impl; + typedef typename impl::type type; + + static type call(Stack const & stack) + { + return impl::call(stack.cdr); + } + }; + + template + struct segmented_next_impl_aux + { + typedef Next type; + + static type call(Stack const & stack) + { + return pop_front_car::call(stack); + } + }; + + template + struct segmented_next_impl + : segmented_next_impl_aux + {}; + } +}} + +#endif diff --git a/include/boost/fusion/iterator/segmented_iterator.hpp b/include/boost/fusion/iterator/segmented_iterator.hpp new file mode 100644 index 00000000..21095e78 --- /dev/null +++ b/include/boost/fusion/iterator/segmented_iterator.hpp @@ -0,0 +1,15 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_SEGMENTED_ITERATOR_HPP_INCLUDED) +#define BOOST_FUSION_SEGMENTED_ITERATOR_HPP_INCLUDED + +#include +#include +#include +#include + +#endif diff --git a/include/boost/fusion/sequence/intrinsic.hpp b/include/boost/fusion/sequence/intrinsic.hpp index 8c5f4abd..0d60d962 100644 --- a/include/boost/fusion/sequence/intrinsic.hpp +++ b/include/boost/fusion/sequence/intrinsic.hpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include diff --git a/include/boost/fusion/sequence/intrinsic/at.hpp b/include/boost/fusion/sequence/intrinsic/at.hpp index 9ccbfc64..5820394b 100644 --- a/include/boost/fusion/sequence/intrinsic/at.hpp +++ b/include/boost/fusion/sequence/intrinsic/at.hpp @@ -9,6 +9,7 @@ #include #include +#include #include #include diff --git a/include/boost/fusion/sequence/intrinsic/at_key.hpp b/include/boost/fusion/sequence/intrinsic/at_key.hpp index 30fefe01..b75dc517 100644 --- a/include/boost/fusion/sequence/intrinsic/at_key.hpp +++ b/include/boost/fusion/sequence/intrinsic/at_key.hpp @@ -9,6 +9,7 @@ #define BOOST_FUSION_AT_KEY_20060304_1755 #include +#include #include #include #include diff --git a/include/boost/fusion/sequence/intrinsic/back.hpp b/include/boost/fusion/sequence/intrinsic/back.hpp index 1f3567f9..adfacc75 100644 --- a/include/boost/fusion/sequence/intrinsic/back.hpp +++ b/include/boost/fusion/sequence/intrinsic/back.hpp @@ -7,6 +7,7 @@ #if !defined(FUSION_BACK_09162005_0350) #define FUSION_BACK_09162005_0350 +#include #include #include #include diff --git a/include/boost/fusion/sequence/intrinsic/begin.hpp b/include/boost/fusion/sequence/intrinsic/begin.hpp index c9ece3ab..cc8506b9 100644 --- a/include/boost/fusion/sequence/intrinsic/begin.hpp +++ b/include/boost/fusion/sequence/intrinsic/begin.hpp @@ -7,9 +7,14 @@ #if !defined(FUSION_BEGIN_04052005_1132) #define FUSION_BEGIN_04052005_1132 +#include +#include +#include +#include #include #include -#include +#include +#include namespace boost { namespace fusion { @@ -26,7 +31,13 @@ namespace boost { namespace fusion struct begin_impl { template - struct apply; + struct apply + : mpl::if_< + traits::is_segmented + , detail::segmented_begin + , blank + >::type + {}; }; template <> diff --git a/include/boost/fusion/sequence/intrinsic/detail/segmented_begin.hpp b/include/boost/fusion/sequence/intrinsic/detail/segmented_begin.hpp new file mode 100644 index 00000000..968718eb --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/detail/segmented_begin.hpp @@ -0,0 +1,43 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_SEGMENTED_BEGIN_HPP_INCLUDED) +#define BOOST_FUSION_SEGMENTED_BEGIN_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + //auto segmented_begin( seq ) + //{ + // return make_segmented_iterator( segmented_begin_impl( seq, nil ) ); + //} + + template + struct segmented_begin + { + typedef + segmented_iterator< + typename segmented_begin_impl::type + > + type; + + static type call(Sequence& seq) + { + return type( + segmented_begin_impl::call(seq, Nil())); + } + }; + +}}} + +#endif diff --git a/include/boost/fusion/sequence/intrinsic/detail/segmented_begin_impl.hpp b/include/boost/fusion/sequence/intrinsic/detail/segmented_begin_impl.hpp new file mode 100644 index 00000000..50694327 --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/detail/segmented_begin_impl.hpp @@ -0,0 +1,92 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_SEGMENTED_BEGIN_IMPL_HPP_INCLUDED) +#define BOOST_FUSION_SEGMENTED_BEGIN_IMPL_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + template + struct iterator_range; +}} + +namespace boost { namespace fusion { namespace detail +{ + struct segmented_begin_fun + { + template + struct apply + { + typedef + iterator_range< + typename fusion::result_of::begin::type + , typename fusion::result_of::end::type + > + range_type; + + typedef cons type; + typedef mpl::false_ continue_type; + + static type call(Sequence& seq, State const&, Context const& context, segmented_begin_fun) + { + return type(range_type(fusion::begin(seq), fusion::end(seq)), context); + } + }; + }; + + template ::type::value> + struct segmented_begin_impl_aux + { + typedef + segmented_end_impl + end_impl; + + typedef + segmented_fold_until_impl< + Sequence + , typename end_impl::type + , Stack + , segmented_begin_fun + > + fold_impl; + + typedef typename fold_impl::type type; + + static type call(Sequence& seq, Stack const& stack) + { + return fold_impl::call(seq, end_impl::call(seq, stack), stack, segmented_begin_fun()); + } + }; + + template + struct segmented_begin_impl_aux + { + typedef typename result_of::begin::type begin_type; + typedef typename result_of::end::type end_type; + typedef iterator_range pair_type; + typedef cons type; + + static type call(Sequence& seq, Stack stack) + { + return type(pair_type(fusion::begin(seq), fusion::end(seq)), stack); + } + }; + + template + struct segmented_begin_impl + : segmented_begin_impl_aux + {}; + +}}} + +#endif diff --git a/include/boost/fusion/sequence/intrinsic/detail/segmented_end.hpp b/include/boost/fusion/sequence/intrinsic/detail/segmented_end.hpp new file mode 100644 index 00000000..469862ac --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/detail/segmented_end.hpp @@ -0,0 +1,39 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_SEGMENTED_END_HPP_INCLUDED) +#define BOOST_FUSION_SEGMENTED_END_HPP_INCLUDED + +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + //auto segmented_end( seq ) + //{ + // return make_segmented_iterator( segmented_end_impl( seq ) ); + //} + + template + struct segmented_end + { + typedef + segmented_iterator< + typename segmented_end_impl::type + > + type; + + static type call(Sequence & seq) + { + return type( + segmented_end_impl::call(seq, Nil())); + } + }; + +}}} + +#endif diff --git a/include/boost/fusion/sequence/intrinsic/detail/segmented_end_impl.hpp b/include/boost/fusion/sequence/intrinsic/detail/segmented_end_impl.hpp new file mode 100644 index 00000000..149027bc --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/detail/segmented_end_impl.hpp @@ -0,0 +1,59 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_SEGMENTED_END_IMPL_HPP_INCLUDED) +#define BOOST_FUSION_SEGMENTED_END_IMPL_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + template + struct iterator_range; +}} + +namespace boost { namespace fusion { namespace detail +{ + //auto segmented_end_impl( seq, stack ) + //{ + // assert(is_segmented(seq)); + // auto it = end(segments(seq)); + // return cons(iterator_range(it, it), stack); + //} + + template + struct segmented_end_impl + { + BOOST_MPL_ASSERT((traits::is_segmented)); + + typedef + typename result_of::end< + typename remove_reference< + typename add_const< + typename result_of::segments::type + >::type + >::type + >::type + end_type; + + typedef iterator_range pair_type; + typedef cons type; + + static type call(Sequence & seq, Stack stack) + { + end_type end = fusion::end(fusion::segments(seq)); + return type(pair_type(end, end), stack); + } + }; + +}}} + +#endif diff --git a/include/boost/fusion/sequence/intrinsic/detail/segmented_size.hpp b/include/boost/fusion/sequence/intrinsic/detail/segmented_size.hpp new file mode 100644 index 00000000..03cef28f --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/detail/segmented_size.hpp @@ -0,0 +1,54 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_SEGMENTED_SIZE_08112006_1141) +#define BOOST_FUSION_SEGMENTED_SIZE_08112006_1141 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + /////////////////////////////////////////////////////////////////////////// + // calculates the size of any segmented data structure. + template + struct segmented_size; + + /////////////////////////////////////////////////////////////////////////// + template::value> + struct segmented_size_impl + : mpl::fold< + typename remove_reference< + typename add_const< + typename result_of::segments::type + >::type + >::type + , mpl::size_t<0> + , mpl::plus > > + >::type + {}; + + template + struct segmented_size_impl + : result_of::size::type + {}; + + template + struct segmented_size + : segmented_size_impl + {}; + +}}} + +#endif diff --git a/include/boost/fusion/sequence/intrinsic/empty.hpp b/include/boost/fusion/sequence/intrinsic/empty.hpp index 2390a49b..81656282 100644 --- a/include/boost/fusion/sequence/intrinsic/empty.hpp +++ b/include/boost/fusion/sequence/intrinsic/empty.hpp @@ -7,6 +7,7 @@ #if !defined(FUSION_EMPTY_09162005_0335) #define FUSION_EMPTY_09162005_0335 +#include #include #include #include diff --git a/include/boost/fusion/sequence/intrinsic/end.hpp b/include/boost/fusion/sequence/intrinsic/end.hpp index 02476710..e3319719 100644 --- a/include/boost/fusion/sequence/intrinsic/end.hpp +++ b/include/boost/fusion/sequence/intrinsic/end.hpp @@ -7,9 +7,14 @@ #if !defined(FUSION_END_04052005_1141) #define FUSION_END_04052005_1141 +#include +#include +#include +#include #include #include -#include +#include +#include namespace boost { namespace fusion { @@ -26,7 +31,13 @@ namespace boost { namespace fusion struct end_impl { template - struct apply; + struct apply + : mpl::if_< + traits::is_segmented + , detail::segmented_end + , blank + >::type + {}; }; template <> diff --git a/include/boost/fusion/sequence/intrinsic/ext_/segments.hpp b/include/boost/fusion/sequence/intrinsic/ext_/segments.hpp deleted file mode 100755 index 58f148f2..00000000 --- a/include/boost/fusion/sequence/intrinsic/ext_/segments.hpp +++ /dev/null @@ -1,56 +0,0 @@ -/*============================================================================= - Copyright (c) 2006 Eric Niebler - - 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(FUSION_SEGMENTS_04052005_1141) -#define FUSION_SEGMENTS_04052005_1141 - -#include - -namespace boost { namespace fusion -{ - // segments: returns a sequence of sequences - namespace extension - { - template - struct segments_impl - { - template - struct apply {}; - }; - } - - namespace result_of - { - template - struct segments - { - typedef typename - extension::segments_impl::type>:: - template apply::type - type; - }; - } - - template - typename result_of::segments::type - segments(Sequence & seq) - { - return - extension::segments_impl::type>:: - template apply::call(seq); - } - - template - typename result_of::segments::type - segments(Sequence const& seq) - { - return - extension::segments_impl::type>:: - template apply::call(seq); - } -}} - -#endif diff --git a/include/boost/fusion/sequence/intrinsic/ext_/size_s.hpp b/include/boost/fusion/sequence/intrinsic/ext_/size_s.hpp deleted file mode 100644 index 8b61746a..00000000 --- a/include/boost/fusion/sequence/intrinsic/ext_/size_s.hpp +++ /dev/null @@ -1,57 +0,0 @@ -/*============================================================================= - Copyright (c) 2006 Eric Niebler - - 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(FUSION_SIZE_S_08112006_1141) -#define FUSION_SIZE_S_08112006_1141 - -#include -#include -#include -#include -#include -#include - -namespace boost { namespace fusion -{ - /////////////////////////////////////////////////////////////////////////// - // calculates the size of any segmented data structure. - template::value> - struct segmented_size; - - namespace detail - { - struct size_plus - { - template - struct result; - - template - struct result - : mpl::plus< - segmented_size::type> - , typename remove_reference::type - > - {}; - }; - } - - /////////////////////////////////////////////////////////////////////////// - template - struct segmented_size - : result_of::fold< - typename result_of::segments::type - , mpl::size_t<0> - , detail::size_plus - >::type - {}; - - template - struct segmented_size - : result_of::size - {}; -}} - -#endif diff --git a/include/boost/fusion/sequence/intrinsic/front.hpp b/include/boost/fusion/sequence/intrinsic/front.hpp index bb79cfa9..3b50530f 100644 --- a/include/boost/fusion/sequence/intrinsic/front.hpp +++ b/include/boost/fusion/sequence/intrinsic/front.hpp @@ -7,6 +7,7 @@ #if !defined(FUSION_FRONT_09162005_0343) #define FUSION_FRONT_09162005_0343 +#include #include #include #include diff --git a/include/boost/fusion/sequence/intrinsic/has_key.hpp b/include/boost/fusion/sequence/intrinsic/has_key.hpp index f254eb1e..946ebba0 100644 --- a/include/boost/fusion/sequence/intrinsic/has_key.hpp +++ b/include/boost/fusion/sequence/intrinsic/has_key.hpp @@ -7,6 +7,7 @@ #if !defined(FUSION_HAS_KEY_09232005_1454) #define FUSION_HAS_KEY_09232005_1454 +#include #include #include #include diff --git a/include/boost/fusion/sequence/intrinsic/segments.hpp b/include/boost/fusion/sequence/intrinsic/segments.hpp new file mode 100644 index 00000000..afd5d400 --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/segments.hpp @@ -0,0 +1,76 @@ +/*============================================================================= + Copyright (c) 2006 Eric Niebler + + 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_SEGMENTS_04052005_1141) +#define BOOST_FUSION_SEGMENTS_04052005_1141 + +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + // Special tags: + struct sequence_facade_tag; + struct iterator_range_tag; + + // segments: returns a sequence of sequences + namespace extension + { + template + struct segments_impl + { + template + struct apply {}; + }; + + template <> + struct segments_impl + { + template + struct apply : Sequence::template segments {}; + }; + + template <> + struct segments_impl; + } + + namespace result_of + { + template + struct segments + { + typedef typename traits::tag_of::type tag_type; + + typedef typename + extension::segments_impl::template apply::type + type; + }; + } + + template + inline typename + lazy_disable_if< + is_const + , result_of::segments + >::type + segments(Sequence& seq) + { + typedef typename traits::tag_of::type tag_type; + return extension::segments_impl::template apply::call(seq); + } + + template + inline typename result_of::segments::type + segments(Sequence const& seq) + { + typedef typename traits::tag_of::type tag_type; + return extension::segments_impl::template apply::call(seq); + } +}} + +#endif diff --git a/include/boost/fusion/sequence/intrinsic/size.hpp b/include/boost/fusion/sequence/intrinsic/size.hpp index 2a3cb7f8..f29ea1ba 100644 --- a/include/boost/fusion/sequence/intrinsic/size.hpp +++ b/include/boost/fusion/sequence/intrinsic/size.hpp @@ -7,8 +7,13 @@ #if !defined(FUSION_SIZE_05052005_0214) #define FUSION_SIZE_05052005_0214 +#include +#include #include +#include #include +#include +#include namespace boost { namespace fusion { @@ -24,8 +29,17 @@ namespace boost { namespace fusion template struct size_impl { + template + struct unsegmented_size : Sequence::size {}; + template - struct apply : Sequence::size {}; + struct apply + : mpl::if_< + traits::is_segmented + , detail::segmented_size + , unsegmented_size + >::type + {}; }; template <> diff --git a/include/boost/fusion/sequence/intrinsic/value_at.hpp b/include/boost/fusion/sequence/intrinsic/value_at.hpp index 01cdc9d5..f64c9735 100644 --- a/include/boost/fusion/sequence/intrinsic/value_at.hpp +++ b/include/boost/fusion/sequence/intrinsic/value_at.hpp @@ -8,6 +8,7 @@ #define FUSION_VALUE_AT_05052005_0229 #include +#include #include namespace boost { namespace fusion diff --git a/include/boost/fusion/sequence/intrinsic/value_at_key.hpp b/include/boost/fusion/sequence/intrinsic/value_at_key.hpp index d7f84cd9..4c15521d 100644 --- a/include/boost/fusion/sequence/intrinsic/value_at_key.hpp +++ b/include/boost/fusion/sequence/intrinsic/value_at_key.hpp @@ -9,6 +9,7 @@ #define FUSION_VALUE_AT_KEY_05052005_0229 #include +#include #include #include #include diff --git a/include/boost/fusion/sequence/intrinsic_fwd.hpp b/include/boost/fusion/sequence/intrinsic_fwd.hpp new file mode 100644 index 00000000..75077dfa --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic_fwd.hpp @@ -0,0 +1,203 @@ +/*============================================================================= + Copyright (c) 2001-2006 Joel de Guzman + + 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_SEQUENCE_INTRINSIC_FWD_HPP_INCLUDED) +#define BOOST_FUSION_SEQUENCE_INTRINSIC_FWD_HPP_INCLUDED + +#include +#include +#include + +namespace boost { namespace fusion +{ + namespace extension + { + template + struct at_impl; + + template + struct begin_impl; + + template + struct empty_impl; + + template + struct end_impl; + + template + struct has_key_impl; + + template + struct segments_impl; + + template + struct size_impl; + + template + struct value_at_impl; + + template + struct at_key_impl; + + template + struct value_at_key_impl; + } + + namespace result_of + { + template + struct at; + + template + struct at_c; + + template + struct back; + + template + struct begin; + + template + struct empty; + + template + struct end; + + template + struct front; + + template + struct has_key; + + template + struct segments; + + template + struct size; + + template + struct value_at; + + template + struct value_at_c; + + template + struct at_key; + + template + struct value_at_key; + } + + template + typename + lazy_disable_if< + is_const + , result_of::at + >::type + at(Sequence& seq); + + template + typename result_of::at::type + at(Sequence const& seq); + + template + typename + lazy_disable_if< + is_const + , result_of::at_c + >::type + at_c(Sequence& seq); + + template + typename result_of::at_c::type + at_c(Sequence const& seq); + + template + typename result_of::back::type + back(Sequence& seq); + + template + typename result_of::back::type + back(Sequence const& seq); + + template + typename + lazy_enable_if< + traits::is_sequence + , result_of::begin + >::type const + begin(Sequence& seq); + + template + typename + lazy_enable_if< + traits::is_sequence + , result_of::begin + >::type const + begin(Sequence const& seq); + + template + typename result_of::empty::type + empty(Sequence const&); + + template + typename + lazy_enable_if< + traits::is_sequence + , result_of::end + >::type const + end(Sequence& seq); + + template + typename + lazy_enable_if< + traits::is_sequence + , result_of::end + >::type const + end(Sequence const& seq); + + template + typename result_of::front::type + front(Sequence& seq); + + template + typename result_of::front::type + front(Sequence const& seq); + + template + typename result_of::has_key::type + has_key(Sequence const& seq); + + template + typename + lazy_disable_if< + is_const + , result_of::segments + >::type + segments(Sequence& seq); + + template + typename result_of::segments::type + segments(Sequence const& seq); + + template + typename result_of::size::type + size(Sequence const&); + + template + typename + lazy_disable_if< + is_const + , result_of::at_key + >::type + at_key(Sequence& seq); + + template + typename result_of::at_key::type + at_key(Sequence const& seq); +}} + +#endif diff --git a/include/boost/fusion/support.hpp b/include/boost/fusion/support.hpp index 012ee107..f1cad29a 100644 --- a/include/boost/fusion/support.hpp +++ b/include/boost/fusion/support.hpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include diff --git a/include/boost/fusion/support/detail/segmented_fold_until_impl.hpp b/include/boost/fusion/support/detail/segmented_fold_until_impl.hpp new file mode 100644 index 00000000..08096c16 --- /dev/null +++ b/include/boost/fusion/support/detail/segmented_fold_until_impl.hpp @@ -0,0 +1,389 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_SEGMENTED_FOLD_UNTIL_IMPL_HPP_INCLUDED) +#define BOOST_FUSION_SEGMENTED_FOLD_UNTIL_IMPL_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +// fun(seq, state, context) +// seq: a non-segmented range +// state: the state of the fold so far +// context: the path to the current range +// +// returns: (state', fcontinue) + +namespace boost { namespace fusion +{ + template + struct iterator_range; + + template + struct segmented_iterator; + + namespace result_of + { + template + struct make_segmented_iterator + { + typedef + iterator_range< + Cur + , typename result_of::end< + typename remove_reference< + typename add_const< + typename result_of::deref< + typename Context::car_type::begin_type + >::type + >::type + >::type + >::type + > + range_type; + + typedef + segmented_iterator > + type; + }; + } + + template + typename result_of::make_segmented_iterator::type + make_segmented_iterator(Cur const& cur, Context const& context) + { + typedef result_of::make_segmented_iterator impl_type; + typedef typename impl_type::type type; + typedef typename impl_type::range_type range_type; + return type(cons(range_type(cur, fusion::end(*context.car.first)), context)); + } + + namespace detail + { + template < + typename Begin + , typename End + , typename State + , typename Context + , typename Fun + , bool IsEmpty + > + struct segmented_fold_until_iterate_skip_empty; + + template < + typename Begin + , typename End + , typename State + , typename Context + , typename Fun + , bool IsDone = result_of::equal_to::type::value + > + struct segmented_fold_until_iterate; + + template < + typename Sequence + , typename State + , typename Context + , typename Fun + , bool IsSegmented = traits::is_segmented::type::value + > + struct segmented_fold_until_impl; + + template + struct segmented_fold_until_on_segments; + + //auto push_context(cur, end, context) + //{ + // return push_back(context, segment_sequence(iterator_range(cur, end))); + //} + + template + struct push_context + { + typedef iterator_range range_type; + typedef cons type; + + static type call(Cur const& cur, End const& end, Context const& context) + { + return cons(range_type(cur, end), context); + } + }; + + //auto make_segmented_iterator(cur, end, context) + //{ + // return segmented_iterator(push_context(cur, end, context)); + //} + // + //auto segmented_fold_until_impl(seq, state, context, fun) + //{ + // if (is_segmented(seq)) + // { + // segmented_fold_until_on_segments(segments(seq), state, context, fun); + // } + // else + // { + // return fun(seq, state, context); + // } + //} + + template < + typename Sequence + , typename State + , typename Context + , typename Fun + , bool IsSegmented + > + struct segmented_fold_until_impl + { + typedef + segmented_fold_until_on_segments< + typename remove_reference< + typename add_const< + typename result_of::segments::type + >::type + >::type + , State + , Context + , Fun + > + impl; + + typedef typename impl::type type; + typedef typename impl::continue_type continue_type; + + static type call(Sequence& seq, State const& state, Context const& context, Fun const& fun) + { + return impl::call(fusion::segments(seq), state, context, fun); + } + }; + + template < + typename Sequence + , typename State + , typename Context + , typename Fun + > + struct segmented_fold_until_impl + { + typedef + typename Fun::template apply + apply_type; + + typedef typename apply_type::type type; + typedef typename apply_type::continue_type continue_type; + + static type call(Sequence& seq, State const& state, Context const& context, Fun const& fun) + { + return apply_type::call(seq, state, context, fun); + } + }; + + //auto segmented_fold_until_on_segments(segs, state, context, fun) + //{ + // auto cur = begin(segs), end = end(segs); + // for (; cur != end; ++cur) + // { + // if (empty(*cur)) + // continue; + // auto context` = push_context(cur, end, context); + // state = segmented_fold_until_impl(*cur, state, context`, fun); + // if (!second(state)) + // return state; + // } + //} + + template + struct continue_wrap + { + typedef typename Apply::continue_type type; + }; + + template + struct segmented_fold_until_iterate_skip_empty + { + // begin != end and !empty(*begin) + typedef + push_context + push_context_impl; + + typedef + typename push_context_impl::type + next_context_type; + + typedef + segmented_fold_until_impl< + typename remove_reference< + typename add_const< + typename result_of::deref::type + >::type + >::type + , State + , next_context_type + , Fun + > + fold_recurse_impl; + + typedef + typename fold_recurse_impl::type + next_state_type; + + typedef + segmented_fold_until_iterate< + typename result_of::next::type + , End + , next_state_type + , Context + , Fun + > + next_iteration_impl; + + typedef + typename mpl::eval_if< + typename fold_recurse_impl::continue_type + , next_iteration_impl + , mpl::identity + >::type + type; + + typedef + typename mpl::eval_if< + typename fold_recurse_impl::continue_type + , continue_wrap + , mpl::identity + >::type + continue_type; + + static type call(Begin const& beg, End const& end, State const& state + , Context const& context, Fun const& fun) + { + return call(beg, end, state, context, fun, typename fold_recurse_impl::continue_type()); + } + + static type call(Begin const& beg, End const& end, State const& state + , Context const& context, Fun const& fun, mpl::true_) // continue + { + return next_iteration_impl::call( + fusion::next(beg) + , end + , fold_recurse_impl::call( + *beg + , state + , push_context_impl::call(beg, end, context) + , fun) + , context + , fun); + } + + static type call(Begin const& beg, End const& end, State const& state + , Context const& context, Fun const& fun, mpl::false_) // break + { + return fold_recurse_impl::call( + *beg + , state + , push_context_impl::call(beg, end, context) + , fun); + } + }; + + template + struct segmented_fold_until_iterate_skip_empty + { + typedef + segmented_fold_until_iterate< + typename result_of::next::type + , End + , State + , Context + , Fun + > + impl; + + typedef typename impl::type type; + typedef typename impl::continue_type continue_type; + + static type call(Begin const& beg, End const& end, State const& state + , Context const& context, Fun const& fun) + { + return impl::call(fusion::next(beg), end, state, context, fun); + } + }; + + template + struct segmented_fold_until_iterate + { + typedef + typename result_of::empty< + typename remove_reference< + typename result_of::deref::type + >::type + >::type + empty_type; + + typedef + segmented_fold_until_iterate_skip_empty + impl; + + typedef typename impl::type type; + typedef typename impl::continue_type continue_type; + + static type call(Begin const& beg, End const& end, State const& state + , Context const& context, Fun const& fun) + { + return impl::call(beg, end, state, context, fun); + } + }; + + template + struct segmented_fold_until_iterate + { + typedef State type; + typedef mpl::true_ continue_type; + + static type call(Begin const&, End const&, State const& state + , Context const&, Fun const&) + { + return state; + } + }; + + template + struct segmented_fold_until_on_segments + { + typedef + segmented_fold_until_iterate< + typename result_of::begin::type + , typename result_of::end::type + , State + , Context + , Fun + > + impl; + + typedef typename impl::type type; + typedef typename impl::continue_type continue_type; + + static type call(Segments& segs, State const& state, Context const& context, Fun const& fun) + { + return impl::call(fusion::begin(segs), fusion::end(segs), state, context, fun); + } + }; + } +}} + +#endif diff --git a/include/boost/fusion/support/ext_/is_segmented.hpp b/include/boost/fusion/support/is_segmented.hpp similarity index 79% rename from include/boost/fusion/support/ext_/is_segmented.hpp rename to include/boost/fusion/support/is_segmented.hpp index 63330a4a..ba571dc5 100644 --- a/include/boost/fusion/support/ext_/is_segmented.hpp +++ b/include/boost/fusion/support/is_segmented.hpp @@ -13,24 +13,27 @@ namespace boost { namespace fusion { // Special tags: struct sequence_facade_tag; - struct boost_tuple_tag; // boost::tuples::tuple tag - struct boost_array_tag; // boost::array tag - struct mpl_sequence_tag; // mpl sequence tag - struct std_pair_tag; // std::pair tag struct iterator_range_tag; namespace extension { - template + template struct is_segmented_impl { - template + template struct apply : mpl::false_ {}; }; - template<> + template <> + struct is_segmented_impl + { + template + struct apply : Sequence::is_segmented {}; + }; + + template <> struct is_segmented_impl; } diff --git a/include/boost/fusion/support/segmented_fold_until.hpp b/include/boost/fusion/support/segmented_fold_until.hpp new file mode 100644 index 00000000..6ea58ac6 --- /dev/null +++ b/include/boost/fusion/support/segmented_fold_until.hpp @@ -0,0 +1,73 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_SEGMENTED_FOLD_UNTIL_HPP_INCLUDED) +#define BOOST_FUSION_SEGMENTED_FOLD_UNTIL_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + //auto segmented_fold_until(seq, state, fun) + //{ + // return first(segmented_fold_until_impl(seq, state, nil, fun)); + //} + + namespace result_of + { + template + struct segmented_fold_until + { + typedef + detail::segmented_fold_until_impl< + Sequence + , State + , fusion::nil + , Fun + > + filter; + + typedef + typename filter::type + type; + }; + } + + template + typename + lazy_disable_if< + is_const + , result_of::segmented_fold_until + >::type + segmented_fold_until(Sequence& seq, State const& state, Fun const& fun) + { + typedef + typename result_of::segmented_fold_until::filter + filter; + + return filter::call(seq, state, fusion::nil(), fun); + } + + template + typename result_of::segmented_fold_until::type + segmented_fold_until(Sequence const& seq, State const& state, Fun const& fun) + { + typedef + typename result_of::segmented_fold_until::filter + filter; + + return filter::call(seq, state, fusion::nil(), fun); + } +}} + +#endif diff --git a/include/boost/fusion/view/ext_/multiple_view.hpp b/include/boost/fusion/view/ext_/multiple_view.hpp deleted file mode 100755 index e34b1d62..00000000 --- a/include/boost/fusion/view/ext_/multiple_view.hpp +++ /dev/null @@ -1,178 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2006 Eric Niebler - - 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 FUSION_MULTIPLE_VIEW_05052005_0335 -#define FUSION_MULTIPLE_VIEW_05052005_0335 - -#include -#include -#include -#include -#include -#include -#include - -namespace boost { namespace fusion -{ - struct multiple_view_tag; - struct forward_traversal_tag; - struct fusion_sequence_tag; - - template - struct multiple_view - : sequence_base > - { - typedef multiple_view_tag fusion_tag; - typedef fusion_sequence_tag tag; // this gets picked up by MPL - typedef forward_traversal_tag category; - typedef mpl::true_ is_view; - typedef mpl::int_ size; - typedef T value_type; - - multiple_view() - : val() - {} - - explicit multiple_view(typename detail::call_param::type val) - : val(val) - {} - - value_type val; - }; - - template - inline multiple_view::type> - make_multiple_view(T const& v) - { - return multiple_view::type>(v); - } - - struct multiple_view_iterator_tag; - struct forward_traversal_tag; - - template - struct multiple_view_iterator - : iterator_base > - { - typedef multiple_view_iterator_tag fusion_tag; - typedef forward_traversal_tag category; - typedef typename MultipleView::value_type value_type; - typedef MultipleView multiple_view_type; - typedef Index index; - - explicit multiple_view_iterator(multiple_view_type const &view_) - : view(view_) - {} - - multiple_view_type view; - }; - - namespace extension - { - template - struct next_impl; - - template <> - struct next_impl - { - template - struct apply - { - typedef multiple_view_iterator< - typename mpl::next::type - , typename Iterator::multiple_view_type - > type; - - static type - call(Iterator const &where) - { - return type(where.view); - } - }; - }; - - template - struct end_impl; - - template <> - struct end_impl - { - template - struct apply - { - typedef multiple_view_iterator< - typename Sequence::size - , Sequence - > type; - - static type - call(Sequence &seq) - { - return type(seq); - } - }; - }; - - template - struct deref_impl; - - template <> - struct deref_impl - { - template - struct apply - { - typedef typename Iterator::value_type type; - - static type - call(Iterator const& i) - { - return i.view.val; - } - }; - }; - - template - struct begin_impl; - - template <> - struct begin_impl - { - template - struct apply - { - typedef multiple_view_iterator< - mpl::int_<0> - , Sequence - > type; - - static type - call(Sequence &seq) - { - return type(seq); - } - }; - }; - - template - struct value_of_impl; - - template <> - struct value_of_impl - { - template - struct apply - { - typedef typename Iterator::multiple_view_type multiple_view_type; - typedef typename multiple_view_type::value_type type; - }; - }; - } -}} - -#endif - - diff --git a/include/boost/fusion/view/ext_/segmented_iterator.hpp b/include/boost/fusion/view/ext_/segmented_iterator.hpp deleted file mode 100644 index 79bc707e..00000000 --- a/include/boost/fusion/view/ext_/segmented_iterator.hpp +++ /dev/null @@ -1,448 +0,0 @@ -/*============================================================================= - Copyright (c) 2006 Eric Niebler - - 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) -==============================================================================*/ -#ifndef FUSION_SEGMENTED_ITERATOR_EAN_05032006_1027 -#define FUSION_SEGMENTED_ITERATOR_EAN_05032006_1027 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include // for nil -#include -#include -#include -#include -#include - -namespace boost { namespace fusion -{ - struct fusion_sequence_tag; - - namespace detail - { - using mpl::_; - using mpl::not_; - - //////////////////////////////////////////////////////////////////////////// - template - struct is_empty - : result_of::equal_to< - typename result_of::begin::type - , typename result_of::end::type - > - {}; - - template - struct is_empty - : is_empty - {}; - - //////////////////////////////////////////////////////////////////////////// - struct not_is_empty_pred - { - template - struct apply - : not_ > - {}; - }; - - struct segmented_range_tag; - - //////////////////////////////////////////////////////////////////////////// - template - struct segmented_range - : sequence_base > - { - BOOST_MPL_ASSERT_NOT((is_reference)); - typedef mpl::bool_ is_segmented; - typedef segmented_range_tag fusion_tag; - typedef fusion_sequence_tag tag; // this gets picked up by MPL - typedef mpl::true_ is_view; - - // If this is a range of segments, skip over the empty ones - typedef typename mpl::if_< - is_segmented - , filter_view - , Sequence - >::type sequence_non_ref_type; - - typedef typename mpl::if_< - traits::is_view - , sequence_non_ref_type - , sequence_non_ref_type & - >::type sequence_type; - - typedef - typename fusion::result_of::advance< - typename fusion::result_of::begin::type - , Index - >::type - iterator_type; - - typedef typename traits::category_of::type category; - - explicit segmented_range(Sequence &sequence_) - : sequence(sequence_type(sequence_)) - {} - - segmented_range(sequence_type sequence_, int) - : sequence(sequence_) - {} - - iterator_type where_() const - { - return fusion::advance( - fusion::begin(const_cast(this->sequence)) - ); - } - - sequence_type sequence; - - private: - segmented_range &operator =(segmented_range const &); - }; - } - - namespace extension - { - template<> - struct is_segmented_impl - { - template - struct apply - : Sequence::is_segmented - {}; - }; - - template<> - struct size_impl - { - template - struct apply - : mpl::int_< - result_of::distance< - typename Sequence::iterator_type - , typename result_of::end::type - >::value - > - {}; - }; - - template<> - struct segments_impl - { - template - struct apply - { - typedef Sequence &type; - static type call(Sequence &seq) - { - return seq; - } - }; - }; - - template<> - struct begin_impl - { - template - struct apply - { - typedef typename Sequence::iterator_type type; - static type call(Sequence &seq) - { - return seq.where_(); - } - }; - }; - - template<> - struct end_impl - { - template - struct apply - { - typedef typename Sequence::sequence_non_ref_type sequence; - typedef typename result_of::end::type type; - - static type call(Sequence &seq) - { - return fusion::end(seq.sequence); - } - }; - }; - } - - namespace detail - { - /////////////////////////////////////////////////////////////////////// - template - struct range_next; - - template - struct range_next > - { - typedef typename mpl::next::type index_type; - typedef segmented_range type; - - static type call(segmented_range const &rng) - { - return type(rng.sequence, 0); - } - }; - - /////////////////////////////////////////////////////////////////////// - template - struct is_range_next_empty - : is_empty::type> - {}; - - template<> - struct is_range_next_empty - : mpl::true_ - {}; - - /////////////////////////////////////////////////////////////////////// - template::value> - struct as_segmented_range - { - typedef typename result_of::segments::type segments; - typedef typename remove_reference::type sequence; - typedef segmented_range, true> type; - - static type call(Sequence &seq) - { - segments segs(fusion::segments(seq)); - return type(segs); - } - }; - - template - struct as_segmented_range - { - typedef typename remove_reference::type sequence; - typedef segmented_range, false> type; - - static type call(Sequence &seq) - { - return type(seq); - } - }; - - template - struct as_segmented_range, IsSegmented> - { - typedef segmented_range type; - static type &call(type &seq) - { - return seq; - } - }; - - /////////////////////////////////////////////////////////////////////// - template< - typename Sequence - , typename State = nil - , bool IsSegmented = traits::is_segmented::value - > - struct push_segments - { - typedef typename as_segmented_range::type range; - typedef typename result_of::begin::type begin; - typedef typename result_of::deref::type next_ref; - typedef typename remove_reference::type next; - typedef push_segments > push; - typedef typename push::type type; - - static type call(Sequence &seq, State const &state) - { - range rng(as_segmented_range::call(seq)); - next_ref nxt(*fusion::begin(rng)); - return push::call(nxt, fusion::make_cons(rng, state)); - } - }; - - template - struct push_segments - { - typedef typename as_segmented_range::type range; - typedef cons type; - - static type call(Sequence &seq, State const &state) - { - range rng(as_segmented_range::call(seq)); - return fusion::make_cons(rng, state); - } - }; - - /////////////////////////////////////////////////////////////////////// - template::value> - struct pop_segments - { - typedef range_next next; - typedef push_segments push; - typedef typename push::type type; - - static type call(State const &state) - { - typename next::type rng(next::call(state.car)); - return push::call(rng, state.cdr); - } - }; - - template - struct pop_segments - { - typedef pop_segments pop; - typedef typename pop::type type; - - static type call(State const &state) - { - return pop::call(state.cdr); - } - }; - - template<> - struct pop_segments - { - typedef nil type; - - static type call(nil const &) - { - return nil(); - } - }; - } // namespace detail - - struct segmented_iterator_tag; - - //////////////////////////////////////////////////////////////////////////// - template - struct segmented_iterator - : fusion::iterator_base > - { - typedef segmented_iterator_tag fusion_tag; - typedef fusion::forward_traversal_tag category; - - typedef Cons cons_type; - typedef typename Cons::car_type car_type; - typedef typename Cons::cdr_type cdr_type; - - explicit segmented_iterator(Cons const &c) - : cons_(c) - {} - - cons_type const &cons() const { return this->cons_; }; - car_type const &car() const { return this->cons_.car; }; - cdr_type const &cdr() const { return this->cons_.cdr; }; - - private: - Cons cons_; - }; - - /////////////////////////////////////////////////////////////////////////// - template - struct segmented_begin - { - typedef typename detail::push_segments push; - typedef segmented_iterator type; - - static type call(Sequence &seq) - { - return type(push::call(seq, nil())); - } - }; - - /////////////////////////////////////////////////////////////////////////// - template - struct segmented_end - { - typedef segmented_iterator type; - - static type call(Sequence &) - { - return type(nil()); - } - }; - - namespace extension - { - template<> - struct value_of_impl - { - template - struct apply - { - typedef typename result_of::begin::type begin; - typedef typename result_of::value_of::type type; - }; - }; - - template<> - struct deref_impl - { - template - struct apply - { - typedef typename result_of::begin::type begin; - typedef typename result_of::deref::type type; - - static type call(Iterator const &it) - { - return *fusion::begin(it.car()); - } - }; - }; - - // discards the old head, expands the right child of the new head - // and pushes the result to the head of the list. - - template<> - struct next_impl - { - template< - typename Iterator - , bool IsSegmentDone = detail::is_range_next_empty::value - > - struct apply - { - typedef typename Iterator::cdr_type cdr_type; - typedef detail::range_next next; - typedef segmented_iterator > type; - - static type call(Iterator const &it) - { - return type(fusion::make_cons(next::call(it.car()), it.cdr())); - } - }; - - template - struct apply // segment done, move to next segment - { - typedef typename Iterator::cdr_type cdr_type; - typedef typename detail::pop_segments pop; - typedef segmented_iterator type; - - static type call(Iterator const &it) - { - return type(pop::call(it.cdr())); - } - }; - }; - } -}} // namespace boost::fusion - -#endif diff --git a/include/boost/fusion/view/ext_/segmented_iterator_range.hpp b/include/boost/fusion/view/ext_/segmented_iterator_range.hpp deleted file mode 100755 index 803e642b..00000000 --- a/include/boost/fusion/view/ext_/segmented_iterator_range.hpp +++ /dev/null @@ -1,537 +0,0 @@ -/*============================================================================= - Copyright (c) 2006 Eric Niebler - - 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) -==============================================================================*/ -#ifndef FUSION_SEGMENTED_ITERATOR_RANGE_EAN_05032006_1027 -#define FUSION_SEGMENTED_ITERATOR_RANGE_EAN_05032006_1027 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace boost { namespace fusion -{ - namespace detail - { - //////////////////////////////////////////////////////////////////////////// - template - struct reverse_cons; - - template - struct reverse_cons, State> - { - typedef reverse_cons > reverse; - typedef typename reverse::type type; - - static type call(cons const &cons, State const &state = State()) - { - return reverse::call(cons.cdr, fusion::make_cons(cons.car, state)); - } - }; - - template - struct reverse_cons - { - typedef State type; - - static State const &call(nil const &, State const &state = State()) - { - return state; - } - }; - - //////////////////////////////////////////////////////////////////////////// - // tags - struct full_view {}; - struct left_view {}; - struct right_view {}; - struct center_view {}; - - template - struct segmented_view_tag; - - //////////////////////////////////////////////////////////////////////////// - // a segmented view of that includes all elements either to the - // right or the left of a segmented iterator. - template - struct segmented_view - : sequence_base > - { - typedef segmented_view_tag fusion_tag; - typedef fusion_sequence_tag tag; // this gets picked up by MPL - typedef mpl::true_ is_view; - typedef forward_traversal_tag category; - - explicit segmented_view(Cons1 const &cons) - : cons(cons) - {} - - typedef Cons1 cons_type; - cons_type const &cons; - }; - - // a segmented view that contains all the elements in between - // two segmented iterators - template - struct segmented_view - : sequence_base > - { - typedef segmented_view_tag fusion_tag; - typedef fusion_sequence_tag tag; // this gets picked up by MPL - typedef mpl::true_ is_view; - typedef forward_traversal_tag category; - - segmented_view(Cons1 const &lcons, Cons2 const &rcons) - : left_cons(lcons) - , right_cons(rcons) - {} - - typedef Cons1 left_cons_type; - typedef Cons2 right_cons_type; - - left_cons_type const &left_cons; - right_cons_type const &right_cons; - }; - - //////////////////////////////////////////////////////////////////////////// - // Used to transform a sequence of segments. The first segment is - // bounded by RightCons, and the last segment is bounded by LeftCons - // and all the others are passed through unchanged. - template - struct segments_transform - { - explicit segments_transform(RightCons const &cons_) - : right_cons(cons_) - , left_cons(cons_) - {} - - segments_transform(RightCons const &right_cons_, LeftCons const &left_cons_) - : right_cons(right_cons_) - , left_cons(left_cons_) - {} - - template - struct result_; - - template - struct result_ - { - typedef segmented_view type; - }; - - template - struct result_ - { - typedef segmented_view type; - }; - - template - struct result_ - { - typedef Second type; - }; - - template - struct result; - - template - struct result - : result_< - typename remove_cv::type>::type - , typename remove_cv::type>::type - > - {}; - - template - segmented_view operator ()(right_view, Second &second) const - { - return segmented_view(this->right_cons); - } - - template - segmented_view operator ()(left_view, Second &second) const - { - return segmented_view(this->left_cons); - } - - template - Second &operator ()(full_view, Second &second) const - { - return second; - } - - private: - RightCons const &right_cons; - LeftCons const &left_cons; - }; - - } // namespace detail - - namespace extension - { - //////////////////////////////////////////////////////////////////////////// - template - struct is_segmented_impl > - { - template - struct apply - : mpl::true_ - {}; - }; - - //////////////////////////////////////////////////////////////////////////// - template<> - struct segments_impl > - { - template< - typename Sequence - , typename Cdr = typename Sequence::cons_type::cdr_type - > - struct apply - { - typedef typename Sequence::cons_type::car_type segmented_range; - typedef typename result_of::size::type size; - typedef typename mpl::prior::type size_minus_1; - typedef detail::segments_transform tfx; - typedef joint_view< - single_view const - , multiple_view const - > mask; - typedef transform_view type; - - static type call(Sequence &seq) - { - return type( - mask( - make_single_view(detail::right_view()) - , make_multiple_view(detail::full_view()) - ) - , seq.cons.car - , tfx(seq.cons.cdr) - ); - } - }; - - template - struct apply - { - typedef typename Sequence::cons_type::car_type segmented_range; - typedef typename segmented_range::iterator_type begin; - typedef typename segmented_range::sequence_non_ref_type sequence_type; - typedef typename result_of::end::type end; - typedef iterator_range range; - typedef single_view type; - - static type call(Sequence &seq) - { - return type(range(seq.cons.car.where_, fusion::end(seq.cons.car.sequence))); - } - }; - }; - - //////////////////////////////////////////////////////////////////////////// - template<> - struct segments_impl > - { - template< - typename Sequence - , typename Cdr = typename Sequence::cons_type::cdr_type - > - struct apply - { - typedef typename Sequence::cons_type::car_type right_segmented_range; - typedef typename right_segmented_range::sequence_type sequence_type; - typedef typename right_segmented_range::iterator_type iterator_type; - - typedef iterator_range< - typename result_of::begin::type - , typename result_of::next::type - > segmented_range; - - typedef detail::segments_transform tfx; - typedef typename result_of::size::type size; - typedef typename mpl::prior::type size_minus_1; - typedef joint_view< - multiple_view const - , single_view const - > mask; - typedef transform_view type; - - static type call(Sequence &seq) - { - return type( - mask( - make_multiple_view(detail::full_view()) - , make_single_view(detail::left_view()) - ) - , segmented_range(fusion::begin(seq.cons.car.sequence), fusion::next(seq.cons.car.where_)) - , tfx(seq.cons.cdr) - ); - } - }; - - template - struct apply - { - typedef typename Sequence::cons_type::car_type segmented_range; - typedef typename segmented_range::sequence_non_ref_type sequence_type; - typedef typename result_of::begin::type begin; - typedef typename segmented_range::iterator_type end; - typedef iterator_range range; - typedef single_view type; - - static type call(Sequence &seq) - { - return type(range(fusion::begin(seq.cons.car.sequence), seq.cons.car.where_)); - } - }; - }; - - //////////////////////////////////////////////////////////////////////////// - template<> - struct segments_impl > - { - template - struct apply - { - typedef typename Sequence::right_cons_type right_cons_type; - typedef typename Sequence::left_cons_type left_cons_type; - typedef typename right_cons_type::car_type right_segmented_range; - typedef typename left_cons_type::car_type left_segmented_range; - - typedef iterator_range< - typename result_of::begin::type - , typename result_of::next::type>::type - > segmented_range; - - typedef typename mpl::minus< - typename result_of::size::type - , mpl::int_<2> - >::type size_minus_2; - - BOOST_MPL_ASSERT_RELATION(0, <=, size_minus_2::value); - - typedef detail::segments_transform< - typename left_cons_type::cdr_type - , typename right_cons_type::cdr_type - > tfx; - - typedef joint_view< - multiple_view const - , single_view const - > left_mask; - - typedef joint_view< - single_view const - , left_mask const - > mask; - - typedef transform_view type; - - static type call(Sequence &seq) - { - left_mask lmask( - make_multiple_view(detail::full_view()) - , make_single_view(detail::left_view()) - ); - return type( - mask(make_single_view(detail::right_view()), lmask) - , segmented_range(fusion::begin(seq.left_cons.car), fusion::next(fusion::begin(seq.right_cons.car))) - , tfx(seq.left_cons.cdr, seq.right_cons.cdr) - ); - } - }; - }; - } - - // specialize iterator_range for use with segmented iterators, so that - // it presents a segmented view of the range. - template - struct iterator_range; - - template - struct iterator_range, segmented_iterator > - : sequence_base, segmented_iterator > > - { - typedef typename convert_iterator >::type begin_type; - typedef typename convert_iterator >::type end_type; - typedef typename detail::reverse_cons::type begin_cons_type; - typedef typename detail::reverse_cons::type end_cons_type; - typedef iterator_range_tag fusion_tag; - typedef fusion_sequence_tag tag; // this gets picked up by MPL - typedef typename traits::category_of::type category; - typedef typename result_of::distance::type size; - typedef mpl::true_ is_view; - - iterator_range(segmented_iterator const& first_, segmented_iterator const& last_) - : first(convert_iterator >::call(first_)) - , last(convert_iterator >::call(last_)) - , first_cons(detail::reverse_cons::call(first_.cons())) - , last_cons(detail::reverse_cons::call(last_.cons())) - {} - - begin_type first; - end_type last; - - begin_cons_type first_cons; - end_cons_type last_cons; - }; - - namespace detail - { - - template - struct same_segment - : mpl::false_ - {}; - - template - struct same_segment, cons > - : mpl::and_< - traits::is_segmented - , is_same - > - {}; - - //////////////////////////////////////////////////////////////////////////// - template - struct segments_gen; - - //////////////////////////////////////////////////////////////////////////// - template - struct segments_gen2 - { - typedef segments_gen gen; - typedef typename gen::type type; - - static type call(Cons1 const &cons1, Cons2 const &cons2) - { - return gen::call(cons1.cdr, cons2.cdr); - } - }; - - template - struct segments_gen2 - { - typedef segmented_view view; - typedef typename result_of::segments::type type; - - static type call(Cons1 const &cons1, Cons2 const &cons2) - { - view v(cons1, cons2); - return fusion::segments(v); - } - }; - - template - struct segments_gen2, cons, false> - { - typedef iterator_range< - typename Car1::iterator_type - , typename Car2::iterator_type - > range; - - typedef single_view type; - - static type call(cons const &cons1, cons const &cons2) - { - return type(range(cons1.car.where_, cons2.car.where_)); - } - }; - - //////////////////////////////////////////////////////////////////////////// - template - struct segments_gen - : segments_gen2::value> - {}; - - template - struct segments_gen, nil> - { - typedef segmented_view > view; - typedef typename result_of::segments::type type; - - static type call(cons const &cons, nil const &) - { - view v(cons); - return fusion::segments(v); - } - }; - - template<> - struct segments_gen - { - typedef nil type; - - static type call(nil const &, nil const &) - { - return nil(); - } - }; - } // namespace detail - - namespace extension - { - template - struct is_segmented_impl; - - // An iterator_range of segmented_iterators is segmented - template<> - struct is_segmented_impl - { - template - struct is_segmented_iterator : mpl::false_ {}; - - template - struct is_segmented_iterator > : mpl::true_ {}; - - template - struct apply - : mpl::and_< - is_segmented_iterator - , is_segmented_iterator - > - {}; - }; - - template - struct segments_impl; - - template<> - struct segments_impl - { - template - struct apply - { - typedef typename Sequence::begin_cons_type begin_cons; - typedef typename Sequence::end_cons_type end_cons; - - typedef detail::segments_gen gen; - typedef typename gen::type type; - - static type call(Sequence &sequence) - { - return gen::call(sequence.first_cons, sequence.last_cons); - } - }; - }; - } - -}} - -#endif diff --git a/include/boost/fusion/view/filter_view/detail/next_impl.hpp b/include/boost/fusion/view/filter_view/detail/next_impl.hpp index a436bfc2..d575d3b3 100644 --- a/include/boost/fusion/view/filter_view/detail/next_impl.hpp +++ b/include/boost/fusion/view/filter_view/detail/next_impl.hpp @@ -65,7 +65,7 @@ namespace boost { namespace fusion static type call(Iterator const& i) { - return type(filter::call(i.first)); + return type(filter::iter_call(i.first)); } }; }; diff --git a/include/boost/fusion/view/filter_view/filter_view_iterator.hpp b/include/boost/fusion/view/filter_view/filter_view_iterator.hpp index 8ce63cbd..5da7bf34 100644 --- a/include/boost/fusion/view/filter_view/filter_view_iterator.hpp +++ b/include/boost/fusion/view/filter_view/filter_view_iterator.hpp @@ -55,7 +55,7 @@ namespace boost { namespace fusion typedef Pred pred_type; filter_iterator(First const& in_first) - : first(filter::call(first_converter::call(in_first))) {} + : first(filter::iter_call(first_converter::call(in_first))) {} first_type first; diff --git a/include/boost/fusion/view/iterator_range/detail/is_segmented_impl.hpp b/include/boost/fusion/view/iterator_range/detail/is_segmented_impl.hpp new file mode 100644 index 00000000..032225dc --- /dev/null +++ b/include/boost/fusion/view/iterator_range/detail/is_segmented_impl.hpp @@ -0,0 +1,66 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_IS_SEGMENTED_HPP_INCLUDED) +#define BOOST_FUSION_ITERATOR_RANGE_IS_SEGMENTED_HPP_INCLUDED + +#include +#include + +namespace boost { namespace fusion +{ + struct iterator_range_tag; + + template + struct segmented_iterator; + + namespace extension + { + template + struct is_segmented_impl; + + // An iterator_range of segmented_iterators is segmented + template <> + struct is_segmented_impl + { + private: + template + struct is_segmented_iterator + : mpl::false_ + {}; + + template + struct is_segmented_iterator + : is_segmented_iterator + {}; + + template + struct is_segmented_iterator + : is_segmented_iterator + {}; + + template + struct is_segmented_iterator > + : mpl::true_ + {}; + + public: + template + struct apply + : is_segmented_iterator + { + BOOST_MPL_ASSERT_RELATION( + is_segmented_iterator::value + , == + , is_segmented_iterator::value); + }; + }; + } +}} + +#endif + + diff --git a/include/boost/fusion/view/iterator_range/detail/segmented_iterator_range.hpp b/include/boost/fusion/view/iterator_range/detail/segmented_iterator_range.hpp new file mode 100644 index 00000000..d63c2b32 --- /dev/null +++ b/include/boost/fusion/view/iterator_range/detail/segmented_iterator_range.hpp @@ -0,0 +1,505 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_SEGMENTED_ITERATOR_RANGE_HPP_INCLUDED) +#define BOOST_FUSION_SEGMENTED_ITERATOR_RANGE_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Invariants: +// - Each segmented iterator has a stack +// - Each value in the stack is an iterator range +// - The range at the top of the stack points to values +// - All other ranges point to ranges +// - The front of each range in the stack (besides the +// topmost) is the range above it + +namespace boost { namespace fusion +{ + template + struct iterator_range; +}} + +namespace boost { namespace fusion { namespace detail +{ + //auto make_segment_sequence_front(stack_begin) + //{ + // switch (size(stack_begin)) + // { + // case 1: + // return nil; + // case 2: + // // car(cdr(stack_begin)) is a range over values. + // assert(end(front(car(stack_begin))) == end(car(cdr(stack_begin)))); + // return iterator_range(begin(car(cdr(stack_begin))), end(front(car(stack_begin)))); + // default: + // // car(cdr(stack_begin)) is a range over segments. We replace the + // // front with a view that is restricted. + // assert(end(segments(front(car(stack_begin)))) == end(car(cdr(stack_begin)))); + // return segment_sequence( + // push_front( + // // The following could be a segment_sequence. It then gets wrapped + // // in a single_view, and push_front puts it in a join_view with the + // // following iterator_range. + // iterator_range(next(begin(car(cdr(stack_begin)))), end(segments(front(car(stack_begin))))), + // make_segment_sequence_front(cdr(stack_begin)))); + // } + //} + + template + struct make_segment_sequence_front + { + // assert(end(segments(front(car(stack_begin)))) == end(car(cdr(stack_begin)))); + BOOST_MPL_ASSERT(( + result_of::equal_to< + typename result_of::end< + typename remove_reference< + typename add_const< + typename result_of::segments< + typename remove_reference< + typename add_const< + typename result_of::deref< + typename Stack::car_type::begin_type + >::type + >::type + >::type + >::type + >::type + >::type + >::type + , typename Stack::cdr_type::car_type::end_type + >)); + + typedef + iterator_range< + typename result_of::next< + typename Stack::cdr_type::car_type::begin_type + >::type + , typename result_of::end< + typename remove_reference< + typename add_const< + typename result_of::segments< + typename remove_reference< + typename add_const< + typename result_of::deref< + typename Stack::car_type::begin_type + >::type + >::type + >::type + >::type + >::type + >::type + >::type + > + rest_type; + + typedef + make_segment_sequence_front + recurse; + + typedef + segment_sequence< + typename result_of::push_front< + rest_type const + , typename recurse::type + >::type + > + type; + + static type call(Stack const& stack) + { + //return segment_sequence( + // push_front( + // iterator_range(next(begin(car(cdr(stack_begin)))), end(segments(front(car(stack_begin))))), + // make_segment_sequence_front(cdr(stack_begin)))); + return type( + fusion::push_front( + rest_type(fusion::next(stack.cdr.car.first), fusion::end(fusion::segments(*stack.car.first))) + , recurse::call(stack.cdr))); + } + }; + + template + struct make_segment_sequence_front + { + // assert(end(front(car(stack_begin))) == end(car(cdr(stack_begin)))); + BOOST_MPL_ASSERT(( + result_of::equal_to< + typename result_of::end< + typename remove_reference< + typename add_const< + typename result_of::deref< + typename Stack::car_type::begin_type + >::type + >::type + >::type + >::type + , typename Stack::cdr_type::car_type::end_type + >)); + + typedef + iterator_range< + typename Stack::cdr_type::car_type::begin_type + , typename result_of::end< + typename remove_reference< + typename add_const< + typename result_of::deref< + typename Stack::car_type::begin_type + >::type + >::type + >::type + >::type + > + type; + + static type call(Stack const& stack) + { + // return iterator_range(begin(car(cdr(stack_begin))), end(front(car(stack_begin)))); + return type(stack.cdr.car.first, fusion::end(*stack.car.first)); + } + }; + + template + struct make_segment_sequence_front + { + typedef typename Stack::cdr_type type; // nil + + static type call(Stack const &stack) + { + return stack.cdr; + } + }; + + //auto make_segment_sequence_back(stack_end) + //{ + // switch (size(stack_end)) + // { + // case 1: + // return nil; + // case 2: + // // car(cdr(stack_back)) is a range over values. + // assert(end(front(car(stack_end))) == end(car(cdr(stack_end)))); + // return iterator_range(begin(front(car(stack_end))), begin(car(cdr(stack_end)))); + // default: + // // car(cdr(stack_begin)) is a range over segments. We replace the + // // back with a view that is restricted. + // assert(end(segments(front(car(stack_end)))) == end(car(cdr(stack_end)))); + // return segment_sequence( + // push_back( + // iterator_range(begin(segments(front(car(stack_end)))), begin(car(cdr(stack_end)))), + // make_segment_sequence_back(cdr(stack_end)))); + // } + //} + + template + struct make_segment_sequence_back + { + // assert(end(segments(front(car(stack_begin)))) == end(car(cdr(stack_begin)))); + BOOST_MPL_ASSERT(( + result_of::equal_to< + typename result_of::end< + typename remove_reference< + typename add_const< + typename result_of::segments< + typename remove_reference< + typename add_const< + typename result_of::deref< + typename Stack::car_type::begin_type + >::type + >::type + >::type + >::type + >::type + >::type + >::type + , typename Stack::cdr_type::car_type::end_type + >)); + + typedef + iterator_range< + typename result_of::begin< + typename remove_reference< + typename add_const< + typename result_of::segments< + typename remove_reference< + typename add_const< + typename result_of::deref< + typename Stack::car_type::begin_type + >::type + >::type + >::type + >::type + >::type + >::type + >::type + , typename Stack::cdr_type::car_type::begin_type + > + rest_type; + + typedef + make_segment_sequence_back + recurse; + + typedef + segment_sequence< + typename result_of::push_back< + rest_type const + , typename recurse::type + >::type + > + type; + + static type call(Stack const& stack) + { + // return segment_sequence( + // push_back( + // iterator_range(begin(segments(front(car(stack_end)))), begin(car(cdr(stack_end)))), + // make_segment_sequence_back(cdr(stack_end)))); + return type( + fusion::push_back( + rest_type(fusion::begin(fusion::segments(*stack.car.first)), stack.cdr.car.first) + , recurse::call(stack.cdr))); + } + }; + + template + struct make_segment_sequence_back + { + // assert(end(front(car(stack_end))) == end(car(cdr(stack_end)))); + BOOST_MPL_ASSERT(( + result_of::equal_to< + typename result_of::end< + typename remove_reference< + typename add_const< + typename result_of::deref< + typename Stack::car_type::begin_type + >::type + >::type + >::type + >::type + , typename Stack::cdr_type::car_type::end_type + >)); + + typedef + iterator_range< + typename result_of::begin< + typename remove_reference< + typename add_const< + typename result_of::deref< + typename Stack::car_type::begin_type + >::type + >::type + >::type + >::type + , typename Stack::cdr_type::car_type::begin_type + > + type; + + static type call(Stack const& stack) + { + // return iterator_range(begin(front(car(stack_end))), begin(car(cdr(stack_end)))); + return type(fusion::begin(*stack.car.first), stack.cdr.car.first); + } + }; + + template + struct make_segment_sequence_back + { + typedef typename Stack::cdr_type type; // nil + + static type call(Stack const& stack) + { + return stack.cdr; + } + }; + + //auto make_segmented_range_reduce(stack_begin, stack_end) + //{ + // if (size(stack_begin) == 1 && size(stack_end) == 1) + // { + // return segment_sequence( + // single_view( + // iterator_range(begin(car(stack_begin)), begin(car(stack_end))))); + // } + // else + // { + // // We are in the case where both begin_stack and/or end_stack have + // // more than one element. Throw away any part of the tree where + // // begin and end refer to the same segment. + // if (begin(car(stack_begin)) == begin(car(stack_end))) + // { + // return make_segmented_range_reduce(cdr(stack_begin), cdr(stack_end)); + // } + // else + // { + // // We are in the case where begin_stack and end_stack (a) have + // // more than one element each, and (b) they point to different + // // segments. We must construct a segmented sequence. + // return segment_sequence( + // push_back( + // push_front( + // iterator_range( + // fusion::next(begin(car(stack_begin))), + // begin(car(stack_end))), // a range of (possibly segmented) ranges. + // make_segment_sequence_front(stack_begin)), // should be a (possibly segmented) range. + // make_segment_sequence_back(stack_end))); // should be a (possibly segmented) range. + // } + // } + //} + + template < + typename StackBegin + , typename StackEnd + , int StackBeginSize = StackBegin::size::value + , int StackEndSize = StackEnd::size::value> + struct make_segmented_range_reduce; + + template < + typename StackBegin + , typename StackEnd + , bool SameSegment = + result_of::equal_to< + typename StackBegin::car_type::begin_type + , typename StackEnd::car_type::begin_type + >::type::value> + struct make_segmented_range_reduce2 + { + typedef + iterator_range< + typename result_of::next< + typename StackBegin::car_type::begin_type + >::type + , typename StackEnd::car_type::begin_type + > + rest_type; + + typedef + segment_sequence< + typename result_of::push_back< + typename result_of::push_front< + rest_type const + , typename make_segment_sequence_front::type + >::type const + , typename make_segment_sequence_back::type + >::type + > + type; + + static type call(StackBegin stack_begin, StackEnd stack_end) + { + //return segment_sequence( + // push_back( + // push_front( + // iterator_range( + // fusion::next(begin(car(stack_begin))), + // begin(car(stack_end))), // a range of (possibly segmented) ranges. + // make_segment_sequence_front(stack_begin)), // should be a (possibly segmented) range. + // make_segment_sequence_back(stack_end))); // should be a (possibly segmented) range. + return type( + fusion::push_back( + fusion::push_front( + rest_type(fusion::next(stack_begin.car.first), stack_end.car.first) + , make_segment_sequence_front::call(stack_begin)) + , make_segment_sequence_back::call(stack_end))); + } + }; + + template + struct make_segmented_range_reduce2 + { + typedef + make_segmented_range_reduce< + typename StackBegin::cdr_type + , typename StackEnd::cdr_type + > + impl; + + typedef + typename impl::type + type; + + static type call(StackBegin stack_begin, StackEnd stack_end) + { + return impl::call(stack_begin.cdr, stack_end.cdr); + } + }; + + template + struct make_segmented_range_reduce + : make_segmented_range_reduce2 + {}; + + template + struct make_segmented_range_reduce + { + typedef + iterator_range< + typename StackBegin::car_type::begin_type + , typename StackEnd::car_type::begin_type + > + range_type; + + typedef + single_view + segment_type; + + typedef + segment_sequence + type; + + static type call(StackBegin stack_begin, StackEnd stack_end) + { + //return segment_sequence( + // single_view( + // iterator_range(begin(car(stack_begin)), begin(car(stack_end))))); + return type(segment_type(range_type(stack_begin.car.first, stack_end.car.first))); + } + }; + + //auto make_segmented_range(begin, end) + //{ + // return make_segmented_range_reduce(reverse(begin.context), reverse(end.context)); + //} + + template + struct make_segmented_range + { + typedef reverse_cons reverse_begin_cons; + typedef reverse_cons reverse_end_cons; + + typedef + make_segmented_range_reduce< + typename reverse_begin_cons::type + , typename reverse_end_cons::type + > + impl; + + typedef typename impl::type type; + + static type call(Begin const& begin, End const& end) + { + return impl::call( + reverse_begin_cons::call(begin.context) + , reverse_end_cons::call(end.context)); + } + }; + +}}} + +#endif diff --git a/include/boost/fusion/view/iterator_range/detail/segments_impl.hpp b/include/boost/fusion/view/iterator_range/detail/segments_impl.hpp new file mode 100644 index 00000000..ede49683 --- /dev/null +++ b/include/boost/fusion/view/iterator_range/detail/segments_impl.hpp @@ -0,0 +1,52 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_SEGMENTS_HPP_INCLUDED) +#define BOOST_FUSION_ITERATOR_RANGE_SEGMENTS_HPP_INCLUDED + +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct iterator_range_tag; + + namespace extension + { + template + struct segments_impl; + + template <> + struct segments_impl + { + template + struct apply + { + typedef + detail::make_segmented_range< + typename Sequence::begin_type + , typename Sequence::end_type + > + impl; + + BOOST_MPL_ASSERT((traits::is_segmented)); + + typedef + typename result_of::segments::type + type; + + static type call(Sequence & seq) + { + return fusion::segments(impl::call(seq.first, seq.last)); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/view/iterator_range/detail/size_impl.hpp b/include/boost/fusion/view/iterator_range/detail/size_impl.hpp new file mode 100644 index 00000000..90951b2f --- /dev/null +++ b/include/boost/fusion/view/iterator_range/detail/size_impl.hpp @@ -0,0 +1,37 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_SIZE_IMPL_HPP_INCLUDED) +#define BOOST_FUSION_ITERATOR_RANGE_SIZE_IMPL_HPP_INCLUDED + +#include + +namespace boost { namespace fusion +{ + struct iterator_range_tag; + + namespace extension + { + template + struct size_impl; + + template <> + struct size_impl + { + template + struct apply + : result_of::distance< + typename Seq::begin_type, + typename Seq::end_type + > + {}; + }; + } +}} + +#endif + diff --git a/include/boost/fusion/view/iterator_range/iterator_range.hpp b/include/boost/fusion/view/iterator_range/iterator_range.hpp index 4d16ca6c..1b9d73f9 100644 --- a/include/boost/fusion/view/iterator_range/iterator_range.hpp +++ b/include/boost/fusion/view/iterator_range/iterator_range.hpp @@ -15,7 +15,10 @@ #include #include #include +#include #include +#include +#include #include #include @@ -36,7 +39,6 @@ namespace boost { namespace fusion typedef typename convert_iterator::type end_type; typedef iterator_range_tag fusion_tag; typedef fusion_sequence_tag tag; // this gets picked up by MPL - typedef typename result_of::distance::type size; typedef mpl::true_ is_view; typedef typename traits::category_of::type category; diff --git a/include/boost/fusion/view/joint_view/joint_view.hpp b/include/boost/fusion/view/joint_view/joint_view.hpp index e0d5c090..3452d77f 100644 --- a/include/boost/fusion/view/joint_view/joint_view.hpp +++ b/include/boost/fusion/view/joint_view/joint_view.hpp @@ -1,12 +1,13 @@ /*============================================================================= Copyright (c) 2001-2006 Joel de Guzman - Distributed under the Boost Software License, Version 1.0. (See accompanying + 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(FUSION_JOINT_VIEW_07162005_0140) #define FUSION_JOINT_VIEW_07162005_0140 +#include #include #include #include @@ -50,7 +51,9 @@ namespace boost { namespace fusion typedef typename result_of::end::type last_type; typedef typename result_of::begin::type concat_type; typedef typename result_of::end::type concat_last_type; - typedef typename mpl::plus, result_of::size >::type size; + typedef typename mpl::int_< + result_of::size::value + result_of::size::value> + size; joint_view(Sequence1& in_seq1, Sequence2& in_seq2) : seq1(in_seq1) diff --git a/include/boost/fusion/view/joint_view/joint_view_fwd.hpp b/include/boost/fusion/view/joint_view/joint_view_fwd.hpp new file mode 100644 index 00000000..c3e3b45e --- /dev/null +++ b/include/boost/fusion/view/joint_view/joint_view_fwd.hpp @@ -0,0 +1,18 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + 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_JOINT_VIEW_FWD_HPP_INCLUDED) +#define BOOST_FUSION_JOINT_VIEW_FWD_HPP_INCLUDED + +namespace boost { namespace fusion +{ + struct joint_view_tag; + + template + struct joint_view; +}} + +#endif diff --git a/test/Jamfile b/test/Jamfile index fe8829e6..9cb6120d 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -41,6 +41,10 @@ import testing ; [ run algorithm/reverse_fold.cpp : : : : ] [ run algorithm/reverse_iter_fold.cpp : : : : ] [ run algorithm/reverse.cpp : : : : ] + [ run algorithm/segmented_for_each.cpp : : : : ] + [ run algorithm/segmented_find.cpp : : : : ] + [ run algorithm/segmented_find_if.cpp : : : : ] + [ run algorithm/segmented_fold.cpp : : : : ] [ run algorithm/transform.cpp : : : : ] [ run algorithm/join.cpp : : : : ] [ run algorithm/zip.cpp : : : : ] @@ -83,6 +87,7 @@ import testing ; [ run sequence/map_tie.cpp : : : : ] [ run sequence/nview.cpp : : : : ] [ run sequence/reverse_view.cpp : : : : ] + [ run sequence/segmented_iterator_range.cpp : : : : ] [ run sequence/set.cpp : : : : ] [ run sequence/single_view.cpp : : : : ] [ run sequence/std_pair.cpp : : : : ] @@ -149,17 +154,3 @@ import testing ; ; } - -{ - # Text for extension features, must be explicitly specified on the command line to be run - # TODO these are not in a test-suite because currently test-suites cannot be marked "explicit" - - run algorithm/ext_/for_each_s.cpp ; - explicit for_each_s ; - - run algorithm/ext_/find_if_s.cpp ; - explicit find_if_s ; - - run sequence/ext_/iterator_range_s.cpp ; - explicit iterator_range_s ; -} diff --git a/test/algorithm/erase_key.cpp b/test/algorithm/erase_key.cpp index 418b5d77..81d0f933 100644 --- a/test/algorithm/erase_key.cpp +++ b/test/algorithm/erase_key.cpp @@ -30,7 +30,7 @@ void test_set(Set const& set) using namespace boost::fusion; std::cout << set << std::endl; - BOOST_STATIC_ASSERT(result_of::size::value == 3); + BOOST_STATIC_ASSERT(boost::fusion::result_of::size::value == 3); BOOST_TEST((*find(set) == 1)); BOOST_TEST((*find(set) == 1.5)); BOOST_TEST((*find(set) == "hello")); @@ -47,7 +47,7 @@ void test_map(Map const& map) using namespace boost::fusion; std::cout << map << std::endl; - BOOST_STATIC_ASSERT(result_of::size::value == 3); + BOOST_STATIC_ASSERT(boost::fusion::result_of::size::value == 3); BOOST_TEST(((*find<_1>(map)).second == 1)); BOOST_TEST(((*find<_3>(map)).second == 1.5)); BOOST_TEST(((*find<_4>(map)).second == std::string("hello"))); diff --git a/test/algorithm/ext_/find_if_s.cpp b/test/algorithm/ext_/find_if_s.cpp deleted file mode 100755 index 7f33ea45..00000000 --- a/test/algorithm/ext_/find_if_s.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2006 Joel de Guzman - - 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) -==============================================================================*/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -struct X -{ - operator int() const - { - return 12345; - } -}; - -template -void -process_tree(Tree const &tree) -{ - using namespace boost; - using mpl::_; - - typedef typename fusion::result_of::find_if_s >::type short_iter; - typedef typename fusion::result_of::find_if_s >::type float_iter; - - // find_if_s of a segmented data structure returns generic - // segmented iterators - short_iter si = fusion::find_if_s >(tree); - float_iter fi = fusion::find_if_s >(tree); - - // they behave like ordinary Fusion iterators ... - BOOST_TEST((*si == short('d'))); - BOOST_TEST((*fi == float(1))); -} - -int -main() -{ - using namespace boost::fusion; - - { - using boost::is_same; - using boost::mpl::_; - - typedef vector vector_type; - vector_type v(12345, 'x', 678910, 3.36); - - std::cout << *find_if_s >(v) << std::endl; - BOOST_TEST((*find_if_s >(v) == 'x')); - - std::cout << *find_if_s >(v) << std::endl; - BOOST_TEST((*find_if_s >(v) == 12345)); - - std::cout << *find_if_s >(v) << std::endl; - BOOST_TEST((*find_if_s >(v) == 3.36)); - } - - { - using boost::mpl::vector; - using boost::is_same; - using boost::mpl::_; - - typedef vector mpl_vec; - BOOST_TEST((*find_if_s >(mpl_vec()) == 12345)); - } - - { - using boost::mpl::vector_c; - using boost::mpl::less; - using boost::mpl::int_; - using boost::is_same; - using boost::mpl::_; - - typedef vector_c mpl_vec; - BOOST_TEST((*find_if_s > >(mpl_vec()) == 1)); - } - - { - process_tree( - make_tree( - make_vector(double(0),'B') - , make_tree( - make_vector(1,2,long(3)) - , make_tree(make_vector('a','b','c')) - , make_tree(make_vector(short('d'),'e','f')) - ) - , make_tree( - make_vector(4,5,6) - , make_tree(make_vector(float(1),'h','i')) - , make_tree(make_vector('j','k','l')) - ) - ) - ); - } - - return boost::report_errors(); -} - diff --git a/test/algorithm/fold.hpp b/test/algorithm/fold.hpp index df42d7d7..87a81a7c 100644 --- a/test/algorithm/fold.hpp +++ b/test/algorithm/fold.hpp @@ -59,7 +59,7 @@ struct sum template struct result - : fusion::result_of::make_pair< + : boost::fusion::result_of::make_pair< mpl::int_< boost::remove_reference< State @@ -108,7 +108,7 @@ struct meta_sum #ifdef BOOST_FUSION_TEST_ITER_FOLD typedef typename - fusion::result_of::value_of< + boost::fusion::result_of::value_of< typename boost::remove_reference::type >::type t; @@ -144,7 +144,7 @@ struct fold_test_n { mpl::range_c init_range; - typename fusion::result_of::as_vector< + typename boost::fusion::result_of::as_vector< typename mpl::transform< range , mpl::always @@ -169,20 +169,20 @@ struct fold_test_n { typedef typename #ifdef BOOST_FUSION_TEST_REVERSE_FOLD - fusion::result_of::as_vector< + boost::fusion::result_of::as_vector< typename mpl::copy< mpl::range_c , mpl::front_inserter > >::type >::type #else - fusion::result_of::as_vector >::type + boost::fusion::result_of::as_vector >::type #endif vec; typedef boost::is_same< - typename fusion::result_of::BOOST_FUSION_TEST_FOLD_NAME< + typename boost::fusion::result_of::BOOST_FUSION_TEST_FOLD_NAME< vec , mpl::vector, mpl::int_<0> > , meta_sum diff --git a/test/algorithm/segmented_find.cpp b/test/algorithm/segmented_find.cpp new file mode 100644 index 00000000..3db7b725 --- /dev/null +++ b/test/algorithm/segmented_find.cpp @@ -0,0 +1,62 @@ +/*============================================================================= + Copyright (c) 2001-2006 Joel de Guzman + Copyright (c) 2011 Eric Niebler + + 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) +==============================================================================*/ +#include +#include +#include +#include +#include "../sequence/tree.hpp" + +struct not_there {}; + +template +void +process_tree(Tree const &tree) +{ + using namespace boost; + + typedef typename boost::fusion::result_of::find::type short_iter; + typedef typename boost::fusion::result_of::find::type float_iter; + typedef typename boost::fusion::result_of::find::type not_there_iter; + + // find_if_s of a segmented data structure returns generic + // segmented iterators + short_iter si = fusion::find(tree); + float_iter fi = fusion::find(tree); + + // they behave like ordinary Fusion iterators ... + BOOST_TEST((*si == short('d'))); + BOOST_TEST((*fi == float(1))); + + // Searching for something that's not there should return the end iterator. + not_there_iter nti = fusion::find(tree); + BOOST_TEST((nti == fusion::end(tree))); +} + +int +main() +{ + using namespace boost::fusion; + process_tree( + make_tree( + make_vector(double(0),'B') + , make_tree( + make_vector(1,2,long(3)) + , make_tree(make_vector('a','b','c')) + , make_tree(make_vector(short('d'),'e','f')) + ) + , make_tree( + make_vector(4,5,6) + , make_tree(make_vector(float(1),'h','i')) + , make_tree(make_vector('j','k','l')) + ) + ) + ); + + return boost::report_errors(); +} + diff --git a/test/algorithm/segmented_find_if.cpp b/test/algorithm/segmented_find_if.cpp new file mode 100644 index 00000000..5ee71d10 --- /dev/null +++ b/test/algorithm/segmented_find_if.cpp @@ -0,0 +1,65 @@ +/*============================================================================= + Copyright (c) 2001-2006 Joel de Guzman + Copyright (c) 2011 Eric Niebler + + 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) +==============================================================================*/ +#include +#include +#include +#include +#include +#include +#include "../sequence/tree.hpp" + +struct not_there {}; + +template +void +process_tree(Tree const &tree) +{ + using namespace boost; + using mpl::_; + + typedef typename boost::fusion::result_of::find_if >::type short_iter; + typedef typename boost::fusion::result_of::find_if >::type float_iter; + typedef typename boost::fusion::result_of::find_if >::type not_there_iter; + + // find_if of a segmented data structure returns generic + // segmented iterators + short_iter si = fusion::find_if >(tree); + float_iter fi = fusion::find_if >(tree); + + // they behave like ordinary Fusion iterators ... + BOOST_TEST((*si == short('d'))); + BOOST_TEST((*fi == float(1))); + + // Searching for something that's not there should return the end iterator. + not_there_iter nti = fusion::find_if >(tree); + BOOST_TEST((nti == fusion::end(tree))); +} + +int +main() +{ + using namespace boost::fusion; + process_tree( + make_tree( + make_vector(double(0),'B') + , make_tree( + make_vector(1,2,long(3)) + , make_tree(make_vector('a','b','c')) + , make_tree(make_vector(short('d'),'e','f')) + ) + , make_tree( + make_vector(4,5,6) + , make_tree(make_vector(float(1),'h','i')) + , make_tree(make_vector('j','k','l')) + ) + ) + ); + + return boost::report_errors(); +} + diff --git a/test/algorithm/segmented_fold.cpp b/test/algorithm/segmented_fold.cpp new file mode 100644 index 00000000..cf3c6c16 --- /dev/null +++ b/test/algorithm/segmented_fold.cpp @@ -0,0 +1,63 @@ +/*============================================================================= + Copyright (c) 2001-2006 Joel de Guzman + Copyright (c) 2011 Eric Niebler + + 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) +==============================================================================*/ +#include +#include +#include +#include +#include +#include +#include +#include "../sequence/tree.hpp" + +struct write_string +{ + typedef std::ostream* result_type; + + template + std::ostream* operator()(std::ostream* sout, T const& t) const + { + return &(*sout << t << " "); + } +}; + +template +void +process_tree(Tree const &tree) +{ + using namespace boost; + + std::stringstream str; + fusion::fold(tree, &str, write_string()); + std::string res = str.str(); + + BOOST_TEST_EQ(res, "a b c 1 2 3 100 e f 0 B 1 h i 4 5 6 j k l "); +} + +int +main() +{ + using namespace boost::fusion; + process_tree( + make_tree( + make_vector(double(0),'B') + , make_tree( + make_vector(1,2,long(3)) + , make_tree(make_vector('a','b','c')) + , make_tree(make_vector(short('d'),'e','f')) + ) + , make_tree( + make_vector(4,5,6) + , make_tree(make_vector(float(1),'h','i')) + , make_tree(make_vector('j','k','l')) + ) + ) + ); + + return boost::report_errors(); +} + diff --git a/test/algorithm/ext_/for_each_s.cpp b/test/algorithm/segmented_for_each.cpp old mode 100755 new mode 100644 similarity index 54% rename from test/algorithm/ext_/for_each_s.cpp rename to test/algorithm/segmented_for_each.cpp index 63ffed2c..b1f8c1b7 --- a/test/algorithm/ext_/for_each_s.cpp +++ b/test/algorithm/segmented_for_each.cpp @@ -1,17 +1,15 @@ /*============================================================================= - Copyright (c) 2001-2006 Joel de Guzman, Eric Niebler + Copyright (c) 2001-2006 Joel de Guzman + Copyright (c) 2011 Eric Niebler 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) ==============================================================================*/ #include #include -#include -#include -#include -#include +#include #include -#include +#include "../sequence/tree.hpp" struct print { @@ -22,44 +20,13 @@ struct print } }; -struct increment -{ - template - void operator()(T& v) const - { - ++v; - } -}; - int main() { using namespace boost::fusion; - using boost::mpl::vector_c; - namespace fusion = boost::fusion; { - typedef vector vector_type; - vector_type v(1, 'x', 3.3, "Ruby"); - for_each_s(v, print()); - std::cout << std::endl; - } - - { - typedef vector vector_type; - vector_type v(1, 'x', 3.3, "Ruby"); - for_each_s(v, increment()); - std::cout << v << std::endl; - } - - { - typedef vector_c mpl_vec; - fusion::for_each_s(mpl_vec(), print()); - std::cout << std::endl; - } - - { - fusion::for_each_s( + for_each( make_tree( make_vector(double(0),'B') , make_tree( diff --git a/test/algorithm/transform.cpp b/test/algorithm/transform.cpp index fac0c92a..2b3394a3 100644 --- a/test/algorithm/transform.cpp +++ b/test/algorithm/transform.cpp @@ -109,46 +109,46 @@ main() { typedef range_c sequence_type; sequence_type sequence; - std::cout << transform(sequence, square()) << std::endl; - BOOST_TEST((transform(sequence, square()) == make_vector(25, 36, 49, 64))); + std::cout << boost::fusion::transform(sequence, square()) << std::endl; + BOOST_TEST((boost::fusion::transform(sequence, square()) == make_vector(25, 36, 49, 64))); } { typedef range_c mpl_list1; - std::cout << transform(mpl_list1(), square()) << std::endl; - BOOST_TEST((transform(mpl_list1(), square()) == make_vector(25, 36, 49, 64))); + std::cout << boost::fusion::transform(mpl_list1(), square()) << std::endl; + BOOST_TEST((boost::fusion::transform(mpl_list1(), square()) == make_vector(25, 36, 49, 64))); } { vector tup(1, 2, 3); - std::cout << transform(tup, square()) << std::endl; - BOOST_TEST((transform(tup, square()) == make_vector(1, 4, 9))); + std::cout << boost::fusion::transform(tup, square()) << std::endl; + BOOST_TEST((boost::fusion::transform(tup, square()) == make_vector(1, 4, 9))); } { vector tup1(1, 2, 3); vector tup2(4, 5, 6); - std::cout << transform(tup1, tup2, add()) << std::endl; - BOOST_TEST((transform(tup1, tup2, add()) == make_vector(5, 7, 9))); + std::cout << boost::fusion::transform(tup1, tup2, add()) << std::endl; + BOOST_TEST((boost::fusion::transform(tup1, tup2, add()) == make_vector(5, 7, 9))); } { // Unary transform that requires lvalues, just check compilation vector tup1(1, 2, 3); - BOOST_TEST(at_c<0>(transform(tup1, unary_lvalue_transform())) == &at_c<0>(tup1)); - BOOST_TEST(*begin(transform(tup1, unary_lvalue_transform())) == &at_c<0>(tup1)); + BOOST_TEST(at_c<0>(boost::fusion::transform(tup1, unary_lvalue_transform())) == &at_c<0>(tup1)); + BOOST_TEST(*begin(boost::fusion::transform(tup1, unary_lvalue_transform())) == &at_c<0>(tup1)); } { vector tup1(1, 2, 3); vector tup2(4, 5, 6); - BOOST_TEST(at_c<0>(transform(tup1, tup2, binary_lvalue_transform())) == &at_c<0>(tup1)); - BOOST_TEST(*begin(transform(tup1, tup2, binary_lvalue_transform())) == &at_c<0>(tup1)); + BOOST_TEST(at_c<0>(boost::fusion::transform(tup1, tup2, binary_lvalue_transform())) == &at_c<0>(tup1)); + BOOST_TEST(*begin(boost::fusion::transform(tup1, tup2, binary_lvalue_transform())) == &at_c<0>(tup1)); } { vector tup1(1, 2, 3); - BOOST_TEST(transform(tup1, twice) == make_vector(2,4,6)); + BOOST_TEST(boost::fusion::transform(tup1, twice) == make_vector(2,4,6)); } diff --git a/test/compile_time/vector_intrinsic.cpp b/test/compile_time/vector_intrinsic.cpp index 3fa3a77e..3690a496 100644 --- a/test/compile_time/vector_intrinsic.cpp +++ b/test/compile_time/vector_intrinsic.cpp @@ -38,17 +38,17 @@ namespace fusion::at_c<8>(v); fusion::at_c<9>(v); - typedef typename fusion::result_of::value_at_c::type va0; - typedef typename fusion::result_of::value_at_c::type va1; - typedef typename fusion::result_of::value_at_c::type va2; - typedef typename fusion::result_of::value_at_c::type va3; - typedef typename fusion::result_of::value_at_c::type va4; + typedef typename boost::fusion::result_of::value_at_c::type va0; + typedef typename boost::fusion::result_of::value_at_c::type va1; + typedef typename boost::fusion::result_of::value_at_c::type va2; + typedef typename boost::fusion::result_of::value_at_c::type va3; + typedef typename boost::fusion::result_of::value_at_c::type va4; - typedef typename fusion::result_of::value_at_c::type va5; - typedef typename fusion::result_of::value_at_c::type va6; - typedef typename fusion::result_of::value_at_c::type va7; - typedef typename fusion::result_of::value_at_c::type va8; - typedef typename fusion::result_of::value_at_c::type va9; + typedef typename boost::fusion::result_of::value_at_c::type va5; + typedef typename boost::fusion::result_of::value_at_c::type va6; + typedef typename boost::fusion::result_of::value_at_c::type va7; + typedef typename boost::fusion::result_of::value_at_c::type va8; + typedef typename boost::fusion::result_of::value_at_c::type va9; fusion::begin(v); fusion::end(v); diff --git a/test/functional/invoke.cpp b/test/functional/invoke.cpp index 460e1e29..52740eec 100644 --- a/test/functional/invoke.cpp +++ b/test/functional/invoke.cpp @@ -331,7 +331,7 @@ void test_sequence_n(Sequence & seq, mpl::int_<3>) template void test_sequence(Sequence & seq) { - test_sequence_n(seq, mpl::int_::value>()); + test_sequence_n(seq, mpl::int_::value>()); } @@ -340,18 +340,18 @@ void result_type_tests() using boost::is_same; BOOST_TEST(( is_same< - fusion::result_of::invoke >::type, int + boost::fusion::result_of::invoke >::type, int >::value )); // disabled until boost::result_of supports it // BOOST_TEST(( is_same< -// fusion::result_of::invoke >::type, int +// boost::fusion::result_of::invoke >::type, int // >::value )); BOOST_TEST(( is_same< - fusion::result_of::invoke >::type, int + boost::fusion::result_of::invoke >::type, int >::value )); // disabled until boost::result_of supports it // BOOST_TEST(( is_same< -// fusion::result_of::invoke >::type, int +// boost::fusion::result_of::invoke >::type, int // >::value )); } diff --git a/test/functional/invoke_function_object.cpp b/test/functional/invoke_function_object.cpp index 375bc4c5..31357aa8 100644 --- a/test/functional/invoke_function_object.cpp +++ b/test/functional/invoke_function_object.cpp @@ -182,16 +182,16 @@ void test_sequence_n(Sequence & seq, mpl::int_<3>) template void test_sequence(Sequence & seq) { - test_sequence_n(seq, mpl::int_::value>()); + test_sequence_n(seq, mpl::int_::value>()); } void result_type_tests() { using boost::is_same; - BOOST_TEST(( is_same< fusion::result_of::invoke_function_object< nullary_fobj, fusion::vector<> >::type, int >::value )); - BOOST_TEST(( is_same< fusion::result_of::invoke_function_object< fobj, fusion::vector >::type, int >::value )); - BOOST_TEST(( is_same< fusion::result_of::invoke_function_object< fobj, fusion::vector >::type, int >::value )); + BOOST_TEST(( is_same< boost::fusion::result_of::invoke_function_object< nullary_fobj, fusion::vector<> >::type, int >::value )); + BOOST_TEST(( is_same< boost::fusion::result_of::invoke_function_object< fobj, fusion::vector >::type, int >::value )); + BOOST_TEST(( is_same< boost::fusion::result_of::invoke_function_object< fobj, fusion::vector >::type, int >::value )); } diff --git a/test/functional/invoke_procedure.cpp b/test/functional/invoke_procedure.cpp index 2dc93c5a..f8db06cc 100644 --- a/test/functional/invoke_procedure.cpp +++ b/test/functional/invoke_procedure.cpp @@ -244,7 +244,7 @@ void test_sequence_n(Sequence & seq, mpl::int_<3>) template void test_sequence(Sequence & seq) { - test_sequence_n(seq, mpl::int_::value>()); + test_sequence_n(seq, mpl::int_::value>()); } int main() diff --git a/test/functional/make_fused.cpp b/test/functional/make_fused.cpp index aab7928a..a207359c 100644 --- a/test/functional/make_fused.cpp +++ b/test/functional/make_fused.cpp @@ -63,7 +63,7 @@ int main() test_func<> f; test_func f_nc; - fusion::result_of::make_fused< test_func<> >::type fused_func + boost::fusion::result_of::make_fused< test_func<> >::type fused_func = fusion::make_fused(f); BOOST_TEST(fused_func(lv_vec) == 1); diff --git a/test/functional/make_fused_function_object.cpp b/test/functional/make_fused_function_object.cpp index dec2411a..87ee8e23 100644 --- a/test/functional/make_fused_function_object.cpp +++ b/test/functional/make_fused_function_object.cpp @@ -73,7 +73,7 @@ int main() test_func<> f; test_func f_nc; - fusion::result_of::make_fused_function_object< test_func<> >::type fused_func + boost::fusion::result_of::make_fused_function_object< test_func<> >::type fused_func = fusion::make_fused_function_object(f); BOOST_TEST(fused_func(lv_vec) == 1); diff --git a/test/functional/make_fused_procedure.cpp b/test/functional/make_fused_procedure.cpp index 754c17bc..ce7e267c 100644 --- a/test/functional/make_fused_procedure.cpp +++ b/test/functional/make_fused_procedure.cpp @@ -69,7 +69,7 @@ int main() test_func<> f; test_func f_nc; - fusion::result_of::make_fused_procedure< test_func<> >::type fused_func + boost::fusion::result_of::make_fused_procedure< test_func<> >::type fused_func = fusion::make_fused_procedure(f); CHECK_EFFECT(fused_func(lv_vec), 1); diff --git a/test/functional/make_unfused.cpp b/test/functional/make_unfused.cpp index ff52e54f..1e286918 100644 --- a/test/functional/make_unfused.cpp +++ b/test/functional/make_unfused.cpp @@ -42,7 +42,7 @@ struct test_func template struct result< Self(Seq &) > - : mpl::if_< mpl::and_< fusion::result_of::empty, RemoveNullary >, + : mpl::if_< mpl::and_< boost::fusion::result_of::empty, RemoveNullary >, boost::blank, mpl::identity >::type { }; @@ -86,14 +86,14 @@ int main() test_func<> f; test_func f_nc; - fusion::result_of::make_unfused< test_func<> >::type unfused_func = + boost::fusion::result_of::make_unfused< test_func<> >::type unfused_func = fusion::make_unfused(f); - fusion::result_of::make_unfused< boost::reference_wrapper< + boost::fusion::result_of::make_unfused< boost::reference_wrapper< test_func > >::type unfused_func_ref = fusion::make_unfused(ref(f_nc)); - fusion::result_of::make_unfused< boost::reference_wrapper< + boost::fusion::result_of::make_unfused< boost::reference_wrapper< test_func const> >::type unfused_func_c_ref = fusion::make_unfused(cref(f_nc)); diff --git a/test/sequence/adapt_adt.cpp b/test/sequence/adapt_adt.cpp index e0693568..73868367 100644 --- a/test/sequence/adapt_adt.cpp +++ b/test/sequence/adapt_adt.cpp @@ -92,7 +92,6 @@ main() { using namespace boost::fusion; using namespace boost; - using namespace std; std::cout << tuple_open('['); std::cout << tuple_close(']'); @@ -111,8 +110,8 @@ main() at_c<1>(p) = 9; BOOST_TEST(p == make_vector(6, 9)); - BOOST_STATIC_ASSERT(result_of::size::value == 2); - BOOST_STATIC_ASSERT(!result_of::empty::value); + BOOST_STATIC_ASSERT(boost::fusion::result_of::size::value == 2); + BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty::value); BOOST_TEST(front(p) == 6); BOOST_TEST(back(p) == 9); @@ -149,7 +148,7 @@ main() { BOOST_MPL_ASSERT((mpl::is_sequence)); BOOST_MPL_ASSERT((boost::is_same< - fusion::result_of::value_at_c::type + boost::fusion::result_of::value_at_c::type , mpl::front::type>)); } @@ -167,8 +166,8 @@ main() at_c<1>(p) = 9; BOOST_TEST(p == make_vector(6, 9)); - BOOST_STATIC_ASSERT(result_of::size::value == 2); - BOOST_STATIC_ASSERT(!result_of::empty::value); + BOOST_STATIC_ASSERT(boost::fusion::result_of::size::value == 2); + BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty::value); BOOST_TEST(front(p) == 6); BOOST_TEST(back(p) == 9); @@ -178,22 +177,22 @@ main() { BOOST_MPL_ASSERT(( boost::is_same< - result_of::front::type, + boost::fusion::result_of::front::type, boost::fusion::extension::adt_attribute_proxy >)); BOOST_MPL_ASSERT(( boost::is_same< - result_of::front::type::type, + boost::fusion::result_of::front::type::type, int >)); BOOST_MPL_ASSERT(( boost::is_same< - result_of::front::type, + boost::fusion::result_of::front::type, boost::fusion::extension::adt_attribute_proxy >)); BOOST_MPL_ASSERT(( boost::is_same< - result_of::front::type::type, + boost::fusion::result_of::front::type::type, int >)); } diff --git a/test/sequence/adapt_adt_named.cpp b/test/sequence/adapt_adt_named.cpp index 7ec88df8..bfa4024d 100644 --- a/test/sequence/adapt_adt_named.cpp +++ b/test/sequence/adapt_adt_named.cpp @@ -84,8 +84,8 @@ main() at_c<1>(p) = 9; BOOST_TEST(p == make_vector(6, 9)); - BOOST_STATIC_ASSERT(result_of::size::value == 2); - BOOST_STATIC_ASSERT(!result_of::empty::value); + BOOST_STATIC_ASSERT(boost::fusion::result_of::size::value == 2); + BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty::value); BOOST_TEST(front(p) == 6); BOOST_TEST(back(p) == 9); @@ -128,7 +128,7 @@ main() { BOOST_MPL_ASSERT((mpl::is_sequence)); BOOST_MPL_ASSERT((boost::is_same< - fusion::result_of::value_at_c::type + boost::fusion::result_of::value_at_c::type , mpl::front::type>)); } diff --git a/test/sequence/adapt_assoc_adt.cpp b/test/sequence/adapt_assoc_adt.cpp index 2d6a07f0..b1672bea 100644 --- a/test/sequence/adapt_assoc_adt.cpp +++ b/test/sequence/adapt_assoc_adt.cpp @@ -74,8 +74,8 @@ main() at_c<1>(p) = 9; BOOST_TEST(p == make_vector(6, 9)); - BOOST_STATIC_ASSERT(result_of::size::value == 2); - BOOST_STATIC_ASSERT(!result_of::empty::value); + BOOST_STATIC_ASSERT(boost::fusion::result_of::size::value == 2); + BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty::value); BOOST_TEST(front(p) == 6); BOOST_TEST(back(p) == 9); @@ -118,12 +118,12 @@ main() { // assoc stuff - BOOST_MPL_ASSERT((result_of::has_key)); - BOOST_MPL_ASSERT((result_of::has_key)); - BOOST_MPL_ASSERT((boost::mpl::not_ >)); + BOOST_MPL_ASSERT((boost::fusion::result_of::has_key)); + BOOST_MPL_ASSERT((boost::fusion::result_of::has_key)); + BOOST_MPL_ASSERT((boost::mpl::not_ >)); - BOOST_MPL_ASSERT((boost::is_same::type, int>)); - BOOST_MPL_ASSERT((boost::is_same::type, int>)); + BOOST_MPL_ASSERT((boost::is_same::type, int>)); + BOOST_MPL_ASSERT((boost::is_same::type, int>)); ns::point p(5, 3); diff --git a/test/sequence/adapt_assoc_adt_named.cpp b/test/sequence/adapt_assoc_adt_named.cpp index 844bec7e..00173496 100644 --- a/test/sequence/adapt_assoc_adt_named.cpp +++ b/test/sequence/adapt_assoc_adt_named.cpp @@ -76,8 +76,8 @@ main() at_c<1>(p) = 9; BOOST_TEST(p == make_vector(6, 9)); - BOOST_STATIC_ASSERT(result_of::size::value == 2); - BOOST_STATIC_ASSERT(!result_of::empty::value); + BOOST_STATIC_ASSERT(boost::fusion::result_of::size::value == 2); + BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty::value); BOOST_TEST(front(p) == 6); BOOST_TEST(back(p) == 9); @@ -123,12 +123,12 @@ main() { // assoc stuff - BOOST_MPL_ASSERT((result_of::has_key)); - BOOST_MPL_ASSERT((result_of::has_key)); - BOOST_MPL_ASSERT((boost::mpl::not_ >)); + BOOST_MPL_ASSERT((boost::fusion::result_of::has_key)); + BOOST_MPL_ASSERT((boost::fusion::result_of::has_key)); + BOOST_MPL_ASSERT((boost::mpl::not_ >)); - BOOST_MPL_ASSERT((boost::is_same::type, int>)); - BOOST_MPL_ASSERT((boost::is_same::type, int>)); + BOOST_MPL_ASSERT((boost::is_same::type, int>)); + BOOST_MPL_ASSERT((boost::is_same::type, int>)); ns::point basep(5, 3); adapted::point p(basep); diff --git a/test/sequence/adapt_assoc_struct.cpp b/test/sequence/adapt_assoc_struct.cpp index 2e3f14ea..ac790d70 100644 --- a/test/sequence/adapt_assoc_struct.cpp +++ b/test/sequence/adapt_assoc_struct.cpp @@ -80,8 +80,8 @@ main() at_c<1>(p) = 9; BOOST_TEST(p == make_vector(6, 9)); - BOOST_STATIC_ASSERT(result_of::size::value == 2); - BOOST_STATIC_ASSERT(!result_of::empty::value); + BOOST_STATIC_ASSERT(boost::fusion::result_of::size::value == 2); + BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty::value); BOOST_TEST(front(p) == 6); BOOST_TEST(back(p) == 9); @@ -117,12 +117,12 @@ main() { // assoc stuff - BOOST_MPL_ASSERT((fusion::result_of::has_key)); - BOOST_MPL_ASSERT((fusion::result_of::has_key)); - BOOST_MPL_ASSERT((mpl::not_ >)); + BOOST_MPL_ASSERT((boost::fusion::result_of::has_key)); + BOOST_MPL_ASSERT((boost::fusion::result_of::has_key)); + BOOST_MPL_ASSERT((mpl::not_ >)); - BOOST_MPL_ASSERT((boost::is_same::type, int>)); - BOOST_MPL_ASSERT((boost::is_same::type, int>)); + BOOST_MPL_ASSERT((boost::is_same::type, int>)); + BOOST_MPL_ASSERT((boost::is_same::type, int>)); ns::point p = {5, 3}; @@ -133,7 +133,7 @@ main() { BOOST_MPL_ASSERT((mpl::is_sequence)); BOOST_MPL_ASSERT((boost::is_same< - fusion::result_of::value_at_c::type + boost::fusion::result_of::value_at_c::type , mpl::front::type>)); } diff --git a/test/sequence/adapt_assoc_struct_named.cpp b/test/sequence/adapt_assoc_struct_named.cpp index 3ae0a380..f24dadd9 100644 --- a/test/sequence/adapt_assoc_struct_named.cpp +++ b/test/sequence/adapt_assoc_struct_named.cpp @@ -61,8 +61,8 @@ main() at_c<1>(p) = 9; BOOST_TEST(p == make_vector(6, 9)); - BOOST_STATIC_ASSERT(result_of::size::value == 2); - BOOST_STATIC_ASSERT(!result_of::empty::value); + BOOST_STATIC_ASSERT(boost::fusion::result_of::size::value == 2); + BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty::value); BOOST_TEST(front(p) == 6); BOOST_TEST(back(p) == 9); @@ -102,12 +102,12 @@ main() { // assoc stuff - BOOST_MPL_ASSERT((result_of::has_key)); - BOOST_MPL_ASSERT((result_of::has_key)); - BOOST_MPL_ASSERT((boost::mpl::not_ >)); + BOOST_MPL_ASSERT((boost::fusion::result_of::has_key)); + BOOST_MPL_ASSERT((boost::fusion::result_of::has_key)); + BOOST_MPL_ASSERT((boost::mpl::not_ >)); - BOOST_MPL_ASSERT((boost::is_same::type, int>)); - BOOST_MPL_ASSERT((boost::is_same::type, int>)); + BOOST_MPL_ASSERT((boost::is_same::type, int>)); + BOOST_MPL_ASSERT((boost::is_same::type, int>)); ns::point basep = {5, 3}; adapted::point p(basep); diff --git a/test/sequence/adapt_assoc_tpl_adt.cpp b/test/sequence/adapt_assoc_tpl_adt.cpp index 92d9df60..1eaa2e55 100644 --- a/test/sequence/adapt_assoc_tpl_adt.cpp +++ b/test/sequence/adapt_assoc_tpl_adt.cpp @@ -78,8 +78,8 @@ main() at_c<1>(p) = 9; BOOST_TEST(p == make_vector(6, 9)); - BOOST_STATIC_ASSERT(result_of::size::value == 2); - BOOST_STATIC_ASSERT(!result_of::empty::value); + BOOST_STATIC_ASSERT(boost::fusion::result_of::size::value == 2); + BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty::value); BOOST_TEST(front(p) == 6); BOOST_TEST(back(p) == 9); @@ -122,12 +122,12 @@ main() { // assoc stuff - BOOST_MPL_ASSERT((result_of::has_key)); - BOOST_MPL_ASSERT((result_of::has_key)); - BOOST_MPL_ASSERT((boost::mpl::not_ >)); + BOOST_MPL_ASSERT((boost::fusion::result_of::has_key)); + BOOST_MPL_ASSERT((boost::fusion::result_of::has_key)); + BOOST_MPL_ASSERT((boost::mpl::not_ >)); - BOOST_MPL_ASSERT((boost::is_same::type, int>)); - BOOST_MPL_ASSERT((boost::is_same::type, int>)); + BOOST_MPL_ASSERT((boost::is_same::type, int>)); + BOOST_MPL_ASSERT((boost::is_same::type, int>)); point p(5, 3); diff --git a/test/sequence/adapt_assoc_tpl_struct.cpp b/test/sequence/adapt_assoc_tpl_struct.cpp index ca751283..a327f9e8 100644 --- a/test/sequence/adapt_assoc_tpl_struct.cpp +++ b/test/sequence/adapt_assoc_tpl_struct.cpp @@ -78,8 +78,8 @@ main() at_c<1>(p) = 9; BOOST_TEST(p == make_vector(6, 9)); - BOOST_STATIC_ASSERT(result_of::size::value == 2); - BOOST_STATIC_ASSERT(!result_of::empty::value); + BOOST_STATIC_ASSERT(boost::fusion::result_of::size::value == 2); + BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty::value); BOOST_TEST(front(p) == 6); BOOST_TEST(back(p) == 9); @@ -115,12 +115,12 @@ main() { // assoc stuff - BOOST_MPL_ASSERT((result_of::has_key)); - BOOST_MPL_ASSERT((result_of::has_key)); - BOOST_MPL_ASSERT((boost::mpl::not_ >)); + BOOST_MPL_ASSERT((boost::fusion::result_of::has_key)); + BOOST_MPL_ASSERT((boost::fusion::result_of::has_key)); + BOOST_MPL_ASSERT((boost::mpl::not_ >)); - BOOST_MPL_ASSERT((boost::is_same::type, int>)); - BOOST_MPL_ASSERT((boost::is_same::type, int>)); + BOOST_MPL_ASSERT((boost::is_same::type, int>)); + BOOST_MPL_ASSERT((boost::is_same::type, int>)); point p = {5, 3}; diff --git a/test/sequence/adapt_struct.cpp b/test/sequence/adapt_struct.cpp index 10b7a89a..f8c1f144 100644 --- a/test/sequence/adapt_struct.cpp +++ b/test/sequence/adapt_struct.cpp @@ -97,8 +97,8 @@ main() at_c<1>(p) = 9; BOOST_TEST(p == make_vector(6, 9)); - BOOST_STATIC_ASSERT(result_of::size::value == 2); - BOOST_STATIC_ASSERT(!result_of::empty::value); + BOOST_STATIC_ASSERT(boost::fusion::result_of::size::value == 2); + BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty::value); BOOST_TEST(front(p) == 6); BOOST_TEST(back(p) == 9); @@ -136,16 +136,16 @@ main() using namespace boost::fusion; using boost::is_same; - typedef result_of::begin::type b; - typedef result_of::end::type e; + typedef boost::fusion::result_of::begin::type b; + typedef boost::fusion::result_of::end::type e; // this fails - BOOST_MPL_ASSERT((is_same::type, e>)); + BOOST_MPL_ASSERT((is_same::type, e>)); } { BOOST_MPL_ASSERT((mpl::is_sequence)); BOOST_MPL_ASSERT((boost::is_same< - fusion::result_of::value_at_c::type + boost::fusion::result_of::value_at_c::type , mpl::front::type>)); } diff --git a/test/sequence/adapt_struct_named.cpp b/test/sequence/adapt_struct_named.cpp index ec803854..0a601e2c 100644 --- a/test/sequence/adapt_struct_named.cpp +++ b/test/sequence/adapt_struct_named.cpp @@ -76,8 +76,8 @@ main() at_c<1>(p) = 9; BOOST_TEST(p == make_vector(6, 9)); - BOOST_STATIC_ASSERT(result_of::size::value == 2); - BOOST_STATIC_ASSERT(!result_of::empty::value); + BOOST_STATIC_ASSERT(boost::fusion::result_of::size::value == 2); + BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty::value); BOOST_TEST(front(p) == 6); BOOST_TEST(back(p) == 9); @@ -119,17 +119,17 @@ main() using namespace boost::fusion; using boost::is_same; - typedef result_of::begin::type b; - typedef result_of::end::type e; + typedef boost::fusion::result_of::begin::type b; + typedef boost::fusion::result_of::end::type e; // this fails - BOOST_MPL_ASSERT((is_same::type, e>)); + BOOST_MPL_ASSERT((is_same::type, e>)); } { BOOST_MPL_ASSERT((mpl::is_sequence)); BOOST_MPL_ASSERT((boost::is_same< - fusion::result_of::value_at_c::type + boost::fusion::result_of::value_at_c::type , mpl::front::type>)); } diff --git a/test/sequence/adapt_tpl_adt.cpp b/test/sequence/adapt_tpl_adt.cpp index babb3370..dc060ed7 100644 --- a/test/sequence/adapt_tpl_adt.cpp +++ b/test/sequence/adapt_tpl_adt.cpp @@ -86,8 +86,8 @@ main() at_c<1>(p) = 9; BOOST_TEST(p == make_vector(6, 9)); - BOOST_STATIC_ASSERT(result_of::size::value == 2); - BOOST_STATIC_ASSERT(!result_of::empty::value); + BOOST_STATIC_ASSERT(boost::fusion::result_of::size::value == 2); + BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty::value); BOOST_TEST(front(p) == 6); BOOST_TEST(back(p) == 9); diff --git a/test/sequence/adapt_tpl_struct.cpp b/test/sequence/adapt_tpl_struct.cpp index 7db3bd8a..352cf995 100644 --- a/test/sequence/adapt_tpl_struct.cpp +++ b/test/sequence/adapt_tpl_struct.cpp @@ -73,8 +73,8 @@ main() at_c<1>(p) = 9; BOOST_TEST(p == make_vector(6, 9)); - BOOST_STATIC_ASSERT(result_of::size::value == 2); - BOOST_STATIC_ASSERT(!result_of::empty::value); + BOOST_STATIC_ASSERT(boost::fusion::result_of::size::value == 2); + BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty::value); BOOST_TEST(front(p) == 6); BOOST_TEST(back(p) == 9); @@ -111,10 +111,10 @@ main() { // begin/end using namespace boost::fusion; - typedef result_of::begin >::type b; - typedef result_of::end >::type e; + typedef boost::fusion::result_of::begin >::type b; + typedef boost::fusion::result_of::end >::type e; // this fails - BOOST_MPL_ASSERT((boost::is_same::type, e>)); + BOOST_MPL_ASSERT((boost::is_same::type, e>)); } return boost::report_errors(); diff --git a/test/sequence/adt_attribute_proxy.cpp b/test/sequence/adt_attribute_proxy.cpp index 4535bb92..d5a947af 100644 --- a/test/sequence/adt_attribute_proxy.cpp +++ b/test/sequence/adt_attribute_proxy.cpp @@ -82,65 +82,65 @@ int main() BOOST_MPL_ASSERT(( boost::is_same< - fusion::result_of::value_at_key::type, + boost::fusion::result_of::value_at_key::type, std::string >)); BOOST_MPL_ASSERT(( boost::is_same< - fusion::result_of::value_at_key::type, - fusion::result_of::value_at_c::type + boost::fusion::result_of::value_at_key::type, + boost::fusion::result_of::value_at_c::type >)); BOOST_MPL_ASSERT(( boost::is_same< - fusion::result_of::value_at_key::type, + boost::fusion::result_of::value_at_key::type, int >)); BOOST_MPL_ASSERT(( boost::is_same< - fusion::result_of::value_at_key::type, - fusion::result_of::value_at_c::type + boost::fusion::result_of::value_at_key::type, + boost::fusion::result_of::value_at_c::type >)); BOOST_MPL_ASSERT(( boost::is_same< - fusion::result_of::at_key::type, + boost::fusion::result_of::at_key::type, fusion::extension::adt_attribute_proxy >)); BOOST_MPL_ASSERT(( boost::is_same< - fusion::result_of::at_key::type, + boost::fusion::result_of::at_key::type, fusion::extension::adt_attribute_proxy >)); BOOST_MPL_ASSERT(( boost::is_same< - fusion::result_of::at_key::type, - fusion::result_of::front::type + boost::fusion::result_of::at_key::type, + boost::fusion::result_of::front::type >)); BOOST_MPL_ASSERT(( boost::is_same< - fusion::result_of::at_key::type, - fusion::result_of::back::type + boost::fusion::result_of::at_key::type, + boost::fusion::result_of::back::type >)); BOOST_MPL_ASSERT(( boost::is_same< - fusion::result_of::at_key::type, + boost::fusion::result_of::at_key::type, fusion::extension::adt_attribute_proxy >)); BOOST_MPL_ASSERT(( boost::is_same< - fusion::result_of::at_key::type, + boost::fusion::result_of::at_key::type, fusion::extension::adt_attribute_proxy >)); BOOST_MPL_ASSERT(( boost::is_same< - fusion::result_of::at_key::type, - fusion::result_of::front::type + boost::fusion::result_of::at_key::type, + boost::fusion::result_of::front::type >)); BOOST_MPL_ASSERT(( boost::is_same< - fusion::result_of::at_key::type, - fusion::result_of::back::type + boost::fusion::result_of::at_key::type, + boost::fusion::result_of::back::type >)); BOOST_MPL_ASSERT(( diff --git a/test/sequence/as_map.cpp b/test/sequence/as_map.cpp index 6c18a3cc..65ff5002 100644 --- a/test/sequence/as_map.cpp +++ b/test/sequence/as_map.cpp @@ -36,7 +36,7 @@ main() { typedef pair p1; typedef pair p2; - result_of::as_map >::type map(make_pair('X'), make_pair("Men")); + boost::fusion::result_of::as_map >::type map(make_pair('X'), make_pair("Men")); std::cout << at_key(map) << std::endl; std::cout << at_key(map) << std::endl; BOOST_TEST(at_key(map) == 'X'); diff --git a/test/sequence/as_set.cpp b/test/sequence/as_set.cpp index 935da42d..f93d7d68 100644 --- a/test/sequence/as_set.cpp +++ b/test/sequence/as_set.cpp @@ -40,7 +40,7 @@ main() } { - result_of::as_set >::type set(1, 1.23, "harru"); + boost::fusion::result_of::as_set >::type set(1, 1.23, "harru"); std::cout << at_key(set) << std::endl; BOOST_TEST(at_key(set) == 1); } diff --git a/test/sequence/boost_tuple.cpp b/test/sequence/boost_tuple.cpp index ef5dfa3b..548fce0e 100644 --- a/test/sequence/boost_tuple.cpp +++ b/test/sequence/boost_tuple.cpp @@ -57,8 +57,8 @@ main() at_c<1>(t) = "mama mia"; BOOST_TEST(t == make_vector(6, "mama mia")); - BOOST_STATIC_ASSERT(result_of::size::value == 2); - BOOST_STATIC_ASSERT(!result_of::empty::value); + BOOST_STATIC_ASSERT(boost::fusion::result_of::size::value == 2); + BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty::value); BOOST_TEST(front(t) == 6); } diff --git a/test/sequence/define_assoc_struct.cpp b/test/sequence/define_assoc_struct.cpp index 6f6326ec..ed8dfbe0 100644 --- a/test/sequence/define_assoc_struct.cpp +++ b/test/sequence/define_assoc_struct.cpp @@ -51,8 +51,8 @@ main() at_c<1>(p) = 9; BOOST_TEST(p == make_vector(6, 9)); - BOOST_STATIC_ASSERT(result_of::size::value == 2); - BOOST_STATIC_ASSERT(!result_of::empty::value); + BOOST_STATIC_ASSERT(boost::fusion::result_of::size::value == 2); + BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty::value); BOOST_TEST(front(p) == 6); BOOST_TEST(back(p) == 9); @@ -88,12 +88,12 @@ main() { // assoc stuff - BOOST_MPL_ASSERT((result_of::has_key)); - BOOST_MPL_ASSERT((result_of::has_key)); - BOOST_MPL_ASSERT((boost::mpl::not_ >)); + BOOST_MPL_ASSERT((boost::fusion::result_of::has_key)); + BOOST_MPL_ASSERT((boost::fusion::result_of::has_key)); + BOOST_MPL_ASSERT((boost::mpl::not_ >)); - BOOST_MPL_ASSERT((boost::is_same::type, int>)); - BOOST_MPL_ASSERT((boost::is_same::type, int>)); + BOOST_MPL_ASSERT((boost::is_same::type, int>)); + BOOST_MPL_ASSERT((boost::is_same::type, int>)); ns::point p(5, 3); diff --git a/test/sequence/define_assoc_tpl_struct.cpp b/test/sequence/define_assoc_tpl_struct.cpp index ec3c7f3b..6d0b5bdb 100644 --- a/test/sequence/define_assoc_tpl_struct.cpp +++ b/test/sequence/define_assoc_tpl_struct.cpp @@ -55,8 +55,8 @@ main() at_c<1>(p) = 9; BOOST_TEST(p == make_vector(6, 9)); - BOOST_STATIC_ASSERT(result_of::size::value == 2); - BOOST_STATIC_ASSERT(!result_of::empty::value); + BOOST_STATIC_ASSERT(boost::fusion::result_of::size::value == 2); + BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty::value); BOOST_TEST(front(p) == 6); BOOST_TEST(back(p) == 9); @@ -92,12 +92,12 @@ main() { // assoc stuff - BOOST_MPL_ASSERT((result_of::has_key)); - BOOST_MPL_ASSERT((result_of::has_key)); - BOOST_MPL_ASSERT((boost::mpl::not_ >)); + BOOST_MPL_ASSERT((boost::fusion::result_of::has_key)); + BOOST_MPL_ASSERT((boost::fusion::result_of::has_key)); + BOOST_MPL_ASSERT((boost::mpl::not_ >)); - BOOST_MPL_ASSERT((boost::is_same::type, int>)); - BOOST_MPL_ASSERT((boost::is_same::type, int>)); + BOOST_MPL_ASSERT((boost::is_same::type, int>)); + BOOST_MPL_ASSERT((boost::is_same::type, int>)); point p(5, 3); diff --git a/test/sequence/define_struct.cpp b/test/sequence/define_struct.cpp index 8d839781..795fdf6e 100644 --- a/test/sequence/define_struct.cpp +++ b/test/sequence/define_struct.cpp @@ -48,8 +48,8 @@ main() at_c<1>(p) = 9; BOOST_TEST(p == make_vector(6, 9)); - BOOST_STATIC_ASSERT(result_of::size::value == 2); - BOOST_STATIC_ASSERT(!result_of::empty::value); + BOOST_STATIC_ASSERT(boost::fusion::result_of::size::value == 2); + BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty::value); BOOST_TEST(front(p) == 6); BOOST_TEST(back(p) == 9); @@ -86,10 +86,10 @@ main() { // begin/end using namespace boost::fusion; - typedef result_of::begin::type b; - typedef result_of::end::type e; + typedef boost::fusion::result_of::begin::type b; + typedef boost::fusion::result_of::end::type e; // this fails - BOOST_MPL_ASSERT((boost::is_same::type, e>)); + BOOST_MPL_ASSERT((boost::is_same::type, e>)); } { diff --git a/test/sequence/define_tpl_struct.cpp b/test/sequence/define_tpl_struct.cpp index a2193709..9896493c 100644 --- a/test/sequence/define_tpl_struct.cpp +++ b/test/sequence/define_tpl_struct.cpp @@ -51,8 +51,8 @@ main() at_c<1>(p) = 9; BOOST_TEST(p == make_vector(6, 9)); - BOOST_STATIC_ASSERT(result_of::size::value == 2); - BOOST_STATIC_ASSERT(!result_of::empty::value); + BOOST_STATIC_ASSERT(boost::fusion::result_of::size::value == 2); + BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty::value); BOOST_TEST(front(p) == 6); BOOST_TEST(back(p) == 9); @@ -89,10 +89,10 @@ main() { // begin/end using namespace boost::fusion; - typedef result_of::begin >::type b; - typedef result_of::end >::type e; + typedef boost::fusion::result_of::begin >::type b; + typedef boost::fusion::result_of::end >::type e; // this fails - BOOST_MPL_ASSERT((boost::is_same::type, e>)); + BOOST_MPL_ASSERT((boost::is_same::type, e>)); } diff --git a/test/sequence/filter_view.cpp b/test/sequence/filter_view.cpp index c052a37b..3fb5a2d1 100644 --- a/test/sequence/filter_view.cpp +++ b/test/sequence/filter_view.cpp @@ -77,7 +77,7 @@ main() filter_view_type view(v); std::cout << view << std::endl; BOOST_TEST((view == make_vector('@', 987654, true, 6.6))); - BOOST_STATIC_ASSERT(result_of::size::value == 4); + BOOST_STATIC_ASSERT(boost::fusion::result_of::size::value == 4); } //cschmidt: This is illegal C++. ADL instantiates less<_, int_<3> > - which @@ -94,7 +94,7 @@ main() filter_view_type view(v); std::cout << view << std::endl; BOOST_TEST((view == make_vector(1, 2, 0, -1))); - BOOST_STATIC_ASSERT(result_of::size::value == 4); + BOOST_STATIC_ASSERT(boost::fusion::result_of::size::value == 4); #endif }*/ @@ -104,7 +104,7 @@ main() typedef vector vec; typedef filter_view filter_view_type; - BOOST_MPL_ASSERT((result_of::equal_to::type, result_of::end::type>)); + BOOST_MPL_ASSERT((boost::fusion::result_of::equal_to::type, boost::fusion::result_of::end::type>)); } { @@ -114,11 +114,11 @@ main() typedef filter_view > > filter_view_type; filter_view_type f(m); - BOOST_MPL_ASSERT((result_of::has_key::type)); - BOOST_MPL_ASSERT_NOT((result_of::has_key::type)); + BOOST_MPL_ASSERT((boost::fusion::result_of::has_key::type)); + BOOST_MPL_ASSERT_NOT((boost::fusion::result_of::has_key::type)); - BOOST_MPL_ASSERT((is_same::type>::type, double>)); - BOOST_MPL_ASSERT((is_same::type>::type, std::string>)); + BOOST_MPL_ASSERT((is_same::type>::type, double>)); + BOOST_MPL_ASSERT((is_same::type>::type, std::string>)); std::cout << deref_data(begin(f)) << std::endl; BOOST_TEST((deref_data(begin(f)) == "Bond")); diff --git a/test/sequence/iterator.hpp b/test/sequence/iterator.hpp index 118bb347..f5c76e47 100644 --- a/test/sequence/iterator.hpp +++ b/test/sequence/iterator.hpp @@ -30,7 +30,7 @@ void test() char const* s = "Hello"; typedef FUSION_SEQUENCE seq_type; seq_type v(1, 'x', 3.3, s); - result_of::begin::type i(v); + boost::fusion::result_of::begin::type i(v); BOOST_TEST(*i == 1); BOOST_TEST(*next(i) == 'x'); @@ -62,7 +62,7 @@ void test() char const* s = "Hello"; typedef FUSION_SEQUENCE const seq_type; seq_type t(1, 'x', 3.3, s); - result_of::begin::type i(t); + boost::fusion::result_of::begin::type i(t); BOOST_TEST(*i == 1); BOOST_TEST(*next(i) == 'x'); @@ -80,22 +80,22 @@ void test() typedef FUSION_SEQUENCE seq_type; typedef FUSION_SEQUENCE const cseq_type; - typedef result_of::begin::type vi1; - typedef result_of::begin::type vi2; - BOOST_STATIC_ASSERT((result_of::equal_to::value)); - BOOST_STATIC_ASSERT((result_of::equal_to::value)); - BOOST_STATIC_ASSERT((result_of::equal_to::value)); - BOOST_STATIC_ASSERT((result_of::equal_to::value)); - BOOST_STATIC_ASSERT((result_of::equal_to::value)); - BOOST_STATIC_ASSERT((result_of::equal_to::value)); + typedef boost::fusion::result_of::begin::type vi1; + typedef boost::fusion::result_of::begin::type vi2; + BOOST_STATIC_ASSERT((boost::fusion::result_of::equal_to::value)); + BOOST_STATIC_ASSERT((boost::fusion::result_of::equal_to::value)); + BOOST_STATIC_ASSERT((boost::fusion::result_of::equal_to::value)); + BOOST_STATIC_ASSERT((boost::fusion::result_of::equal_to::value)); + BOOST_STATIC_ASSERT((boost::fusion::result_of::equal_to::value)); + BOOST_STATIC_ASSERT((boost::fusion::result_of::equal_to::value)); } { typedef FUSION_SEQUENCE seq_type; - typedef result_of::begin::type begin_type; - typedef result_of::end::type end_type; - typedef result_of::next::type i1; - typedef result_of::next::type i2; + typedef boost::fusion::result_of::begin::type begin_type; + typedef boost::fusion::result_of::end::type end_type; + typedef boost::fusion::result_of::next::type i1; + typedef boost::fusion::result_of::next::type i2; BOOST_STATIC_ASSERT((is_same::value)); } @@ -105,7 +105,7 @@ void test() char const* s = "Hello"; typedef FUSION_SEQUENCE seq_type; seq_type t(1, 'x', 3.3, s); - result_of::begin::type i(t); + boost::fusion::result_of::begin::type i(t); BOOST_TEST(*i == 1); BOOST_TEST(*next(i) == 'x'); @@ -138,34 +138,34 @@ void test() typedef FUSION_SEQUENCE seq_type; seq_type t(1, 'x', 3.3, "Hello"); - BOOST_STATIC_ASSERT((result_of::distance< - result_of::begin::type - , result_of::end::type >::value == 4)); + BOOST_STATIC_ASSERT((boost::fusion::result_of::distance< + boost::fusion::result_of::begin::type + , boost::fusion::result_of::end::type >::value == 4)); BOOST_TEST(distance(begin(t), end(t)).value == 4); } - { // Testing tuple iterator result_of::value_of, result_of::deref, result_of::value_at + { // Testing tuple iterator boost::fusion::result_of::value_of, boost::fusion::result_of::deref, boost::fusion::result_of::value_at typedef FUSION_SEQUENCE seq_type; - typedef result_of::begin::type i0; - typedef result_of::next::type i1; - typedef result_of::next::type>::type i2; + typedef boost::fusion::result_of::begin::type i0; + typedef boost::fusion::result_of::next::type i1; + typedef boost::fusion::result_of::next::type>::type i2; BOOST_STATIC_ASSERT(( - is_same::type, int>::value)); + is_same::type, int>::value)); BOOST_STATIC_ASSERT(( - is_same::type, char&>::value)); + is_same::type, char&>::value)); BOOST_STATIC_ASSERT(( is_same::type, FUSION_TRAVERSAL_TAG>::value)); - BOOST_STATIC_ASSERT((is_same::type, int&>::value)); - BOOST_STATIC_ASSERT((is_same::type, char&>::value)); + BOOST_STATIC_ASSERT((is_same::type, int&>::value)); + BOOST_STATIC_ASSERT((is_same::type, char&>::value)); - BOOST_STATIC_ASSERT((is_same::type, int>::value)); - BOOST_STATIC_ASSERT((is_same::type, char&>::value)); + BOOST_STATIC_ASSERT((is_same::type, int>::value)); + BOOST_STATIC_ASSERT((is_same::type, char&>::value)); } { // Testing advance diff --git a/test/sequence/iterator_range.cpp b/test/sequence/iterator_range.cpp index 51288dbd..cf2c27ef 100644 --- a/test/sequence/iterator_range.cpp +++ b/test/sequence/iterator_range.cpp @@ -50,7 +50,7 @@ main() slice_t slice(i1, i3); std::cout << slice << std::endl; BOOST_TEST((slice == make_vector('x', 3.3))); - BOOST_STATIC_ASSERT(result_of::size::value == 2); + BOOST_STATIC_ASSERT(boost::fusion::result_of::size::value == 2); } { @@ -64,7 +64,7 @@ main() slice_t slice(i1, i3); std::cout << slice << std::endl; BOOST_TEST(slice == make_vector()); - BOOST_STATIC_ASSERT(result_of::size::value == 0); + BOOST_STATIC_ASSERT(boost::fusion::result_of::size::value == 0); } } @@ -82,7 +82,7 @@ main() slice_t slice(f, l); std::cout << slice << std::endl; BOOST_TEST((slice == make_vector(3, 4))); - BOOST_STATIC_ASSERT(result_of::size::value == 2); + BOOST_STATIC_ASSERT(boost::fusion::result_of::size::value == 2); } { @@ -90,19 +90,19 @@ main() map_type m(make_pair("foo"), make_pair('x'), make_pair(2)); typedef iterator_range< - result_of::begin::type - , result_of::advance_c::type,2>::type + boost::fusion::result_of::begin::type + , boost::fusion::result_of::advance_c::type,2>::type > range_type; range_type r(begin(m), advance_c<2>(begin(m))); - BOOST_MPL_ASSERT((result_of::has_key::type)); - BOOST_MPL_ASSERT((result_of::has_key::type)); + BOOST_MPL_ASSERT((boost::fusion::result_of::has_key::type)); + BOOST_MPL_ASSERT((boost::fusion::result_of::has_key::type)); - BOOST_MPL_ASSERT((boost::is_same::type>::type, void>)); - BOOST_MPL_ASSERT((boost::is_same::type>::type>::type, double>)); + BOOST_MPL_ASSERT((boost::is_same::type>::type, void>)); + BOOST_MPL_ASSERT((boost::is_same::type>::type>::type, double>)); - BOOST_MPL_ASSERT((boost::is_same::type>::type, std::string>)); - BOOST_MPL_ASSERT((boost::is_same::type>::type>::type, char>)); + BOOST_MPL_ASSERT((boost::is_same::type>::type, std::string>)); + BOOST_MPL_ASSERT((boost::is_same::type>::type>::type, char>)); std::cout << deref_data(begin(r)) << std::endl; std::cout << deref_data(fusion::next(begin(r))) << std::endl; diff --git a/test/sequence/joint_view.cpp b/test/sequence/joint_view.cpp index 900b9a68..f4609b64 100644 --- a/test/sequence/joint_view.cpp +++ b/test/sequence/joint_view.cpp @@ -159,20 +159,20 @@ main() typedef joint_view joint_view_type; joint_view_type j(m,s); - BOOST_MPL_ASSERT((result_of::has_key::type)); - BOOST_MPL_ASSERT((result_of::has_key::type)); - BOOST_MPL_ASSERT((result_of::has_key::type)); + BOOST_MPL_ASSERT((boost::fusion::result_of::has_key::type)); + BOOST_MPL_ASSERT((boost::fusion::result_of::has_key::type)); + BOOST_MPL_ASSERT((boost::fusion::result_of::has_key::type)); - BOOST_MPL_ASSERT((boost::is_same::type>::type, void>)); - BOOST_MPL_ASSERT((boost::is_same::type>::type>::type, std::string>)); + BOOST_MPL_ASSERT((boost::is_same::type>::type, void>)); + BOOST_MPL_ASSERT((boost::is_same::type>::type>::type, std::string>)); BOOST_MPL_ASSERT((boost::is_same< - result_of::key_of::type>::type>::type>::type + boost::fusion::result_of::key_of::type>::type>::type>::type , float>)); - BOOST_MPL_ASSERT((boost::is_same::type>::type, int>)); - BOOST_MPL_ASSERT((boost::is_same::type>::type>::type, std::string>)); + BOOST_MPL_ASSERT((boost::is_same::type>::type, int>)); + BOOST_MPL_ASSERT((boost::is_same::type>::type>::type, std::string>)); BOOST_MPL_ASSERT((boost::is_same< - result_of::value_of_data::type>::type>::type>::type + boost::fusion::result_of::value_of_data::type>::type>::type>::type , float>)); std::cout << deref_data(begin(j)) << std::endl; diff --git a/test/sequence/map.cpp b/test/sequence/map.cpp index e419a7e0..c9ac19f0 100644 --- a/test/sequence/map.cpp +++ b/test/sequence/map.cpp @@ -56,15 +56,15 @@ main() BOOST_TEST(at_key(m) == "Men"); BOOST_STATIC_ASSERT(( - boost::is_same::type, char>::value)); + boost::is_same::type, char>::value)); BOOST_STATIC_ASSERT(( - boost::is_same::type, std::string>::value)); + boost::is_same::type, std::string>::value)); std::cout << m << std::endl; - BOOST_STATIC_ASSERT((result_of::has_key::value)); - BOOST_STATIC_ASSERT((result_of::has_key::value)); - BOOST_STATIC_ASSERT((!result_of::has_key::value)); + BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key::value)); + BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key::value)); + BOOST_STATIC_ASSERT((!boost::fusion::result_of::has_key::value)); std::cout << deref_data(begin(m)) << std::endl; std::cout << deref_data(fusion::next(begin(m))) << std::endl; @@ -72,10 +72,10 @@ main() BOOST_TEST(deref_data(begin(m)) == 'X'); BOOST_TEST(deref_data(fusion::next(begin(m))) == "Men"); - BOOST_STATIC_ASSERT((boost::is_same::type>::type, int>::value)); - BOOST_STATIC_ASSERT((boost::is_same::type>::type>::type, double>::value)); - BOOST_STATIC_ASSERT((boost::is_same::type>::type, char>::value)); - BOOST_STATIC_ASSERT((boost::is_same::type>::type>::type, std::string>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type, int>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type>::type, double>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type, char>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type>::type, std::string>::value)); } { diff --git a/test/sequence/misc.hpp b/test/sequence/misc.hpp index c5b58b45..3a1ee091 100644 --- a/test/sequence/misc.hpp +++ b/test/sequence/misc.hpp @@ -21,7 +21,7 @@ #endif #if !defined(FUSION_SIZE) -#define FUSION_SIZE result_of::size +#define FUSION_SIZE boost::fusion::result_of::size #endif template @@ -144,8 +144,8 @@ test() BOOST_STATIC_ASSERT(FUSION_SIZE::value == 3); BOOST_STATIC_ASSERT(FUSION_SIZE::value == 0); - BOOST_STATIC_ASSERT(!result_of::empty::value); - BOOST_STATIC_ASSERT(result_of::empty::value); + BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty::value); + BOOST_STATIC_ASSERT(boost::fusion::result_of::empty::value); } { // testing front & back diff --git a/test/sequence/reverse_view.cpp b/test/sequence/reverse_view.cpp index 980bdc78..deb3f6d2 100644 --- a/test/sequence/reverse_view.cpp +++ b/test/sequence/reverse_view.cpp @@ -54,9 +54,9 @@ main() std::cout << rev << std::endl; BOOST_TEST((rev == make_vector(s, 123456789, 'x', 123))); - typedef result_of::begin::type first_type; + typedef boost::fusion::result_of::begin::type first_type; first_type first_it(begin(rev)); - typedef result_of::next::type second_type; + typedef boost::fusion::result_of::next::type second_type; second_type second_it(next(first_it)); BOOST_TEST((*second_it == 123456789)); BOOST_TEST((*prior(second_it) == s)); @@ -69,16 +69,16 @@ main() BOOST_TEST((at_c<3>(rev)==123)); BOOST_MPL_ASSERT(( - boost::is_same::type,char const*> + boost::is_same::type,char const*> )); BOOST_MPL_ASSERT(( - boost::is_same::type,long> + boost::is_same::type,long> )); BOOST_MPL_ASSERT(( - boost::is_same::type,char> + boost::is_same::type,char> )); BOOST_MPL_ASSERT(( - boost::is_same::type,int> + boost::is_same::type,int> )); } diff --git a/test/sequence/ext_/iterator_range_s.cpp b/test/sequence/segmented_iterator_range.cpp old mode 100755 new mode 100644 similarity index 81% rename from test/sequence/ext_/iterator_range_s.cpp rename to test/sequence/segmented_iterator_range.cpp index 02a49ad4..e7cfaf46 --- a/test/sequence/ext_/iterator_range_s.cpp +++ b/test/sequence/segmented_iterator_range.cpp @@ -1,17 +1,17 @@ /*============================================================================= Copyright (c) 2001-2006 Joel de Guzman + Copyright (c) 2011 Eric Niebler 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) ==============================================================================*/ +#include #include -#include -#include +#include +#include #include -#include #include #include -#include #include #include #include @@ -19,7 +19,7 @@ #include #include #include -#include +#include "tree.hpp" struct ostream_fun { @@ -43,23 +43,23 @@ process_tree(Tree const &tree) using namespace fusion; using mpl::_; - typedef typename fusion::result_of::find_if_s >::type short_iter; - typedef typename fusion::result_of::find_if_s >::type float_iter; + typedef typename boost::fusion::result_of::find_if >::type short_iter; + typedef typename boost::fusion::result_of::find_if >::type float_iter; typedef iterator_range slice_t; BOOST_STATIC_ASSERT(traits::is_segmented::value); - // find_if_s of a segmented data structure returns generic + // find_if of a segmented data structure returns generic // segmented iterators - short_iter si = find_if_s >(tree); - float_iter fi = find_if_s >(tree); + short_iter si = find_if >(tree); + float_iter fi = find_if >(tree); // If you put them in an iterator range, the range // is automatically a segmented data structure. slice_t slice(si, fi); std::stringstream sout; - fusion::for_each_s(slice, ostream_fun(sout)); + fusion::for_each(slice, ostream_fun(sout)); BOOST_TEST((sout.str() == "100 e f 0 B ")); } @@ -88,7 +88,7 @@ main() slice_t slice(i1, i3); std::cout << slice << std::endl; BOOST_TEST((slice == make_vector('x', 3.3))); - BOOST_STATIC_ASSERT(result_of::size::value == 2); + BOOST_STATIC_ASSERT(boost::fusion::result_of::size::value == 2); } { @@ -102,7 +102,7 @@ main() slice_t slice(i1, i3); std::cout << slice << std::endl; BOOST_TEST(slice == make_vector()); - BOOST_STATIC_ASSERT(result_of::size::value == 0); + BOOST_STATIC_ASSERT(boost::fusion::result_of::size::value == 0); } } @@ -120,7 +120,7 @@ main() slice_t slice(f, l); std::cout << slice << std::endl; BOOST_TEST((slice == make_vector(3, 4))); - BOOST_STATIC_ASSERT(result_of::size::value == 2); + BOOST_STATIC_ASSERT(boost::fusion::result_of::size::value == 2); } { diff --git a/test/sequence/set.cpp b/test/sequence/set.cpp index 4a39c89a..8466e234 100644 --- a/test/sequence/set.cpp +++ b/test/sequence/set.cpp @@ -51,15 +51,15 @@ main() BOOST_TEST(at_key(m) == "Hola"); BOOST_STATIC_ASSERT(( - boost::is_same::type, int>::value)); + boost::is_same::type, int>::value)); BOOST_STATIC_ASSERT(( - boost::is_same::type, std::string>::value)); + boost::is_same::type, std::string>::value)); std::cout << m << std::endl; - BOOST_STATIC_ASSERT((result_of::has_key::value)); - BOOST_STATIC_ASSERT((result_of::has_key::value)); - BOOST_STATIC_ASSERT((!result_of::has_key::value)); + BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key::value)); + BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key::value)); + BOOST_STATIC_ASSERT((!boost::fusion::result_of::has_key::value)); std::cout << deref_data(begin(m)) << std::endl; std::cout << deref_data(fusion::next(begin(m))) << std::endl; @@ -67,10 +67,10 @@ main() BOOST_TEST(deref_data(begin(m)) == 123); BOOST_TEST(deref_data(fusion::next(begin(m))) == "Hola"); - BOOST_STATIC_ASSERT((boost::is_same::type>::type, int>::value)); - BOOST_STATIC_ASSERT((boost::is_same::type>::type>::type, std::string>::value)); - BOOST_STATIC_ASSERT((boost::is_same::type>::type, int>::value)); - BOOST_STATIC_ASSERT((boost::is_same::type>::type>::type, std::string>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type, int>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type>::type, std::string>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type, int>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::type>::type, std::string>::value)); } { diff --git a/test/sequence/single_view.cpp b/test/sequence/single_view.cpp index e9322712..f3285e86 100644 --- a/test/sequence/single_view.cpp +++ b/test/sequence/single_view.cpp @@ -76,7 +76,7 @@ main() BOOST_TEST(end(view1) == advance_c<0>(end(view1))); BOOST_TEST(begin(view1) == advance_c<-1>(end(view1))); BOOST_TEST(1 == size(view1)); - BOOST_MPL_ASSERT((boost::is_same, boost::mpl::int_<0> >::type>)); + BOOST_MPL_ASSERT((boost::is_same, boost::mpl::int_<0> >::type>)); single_view view2; std::cout << view2 << std::endl; diff --git a/test/sequence/std_pair.cpp b/test/sequence/std_pair.cpp index 0a704753..cd8833c8 100644 --- a/test/sequence/std_pair.cpp +++ b/test/sequence/std_pair.cpp @@ -56,8 +56,8 @@ main() at_c<1>(p) = "mama mia"; BOOST_TEST(p == make_vector(6, "mama mia")); - BOOST_STATIC_ASSERT(result_of::size::value == 2); - BOOST_STATIC_ASSERT(!result_of::empty::value); + BOOST_STATIC_ASSERT(boost::fusion::result_of::size::value == 2); + BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty::value); BOOST_TEST(front(p) == 6); BOOST_TEST(back(p) == "mama mia"); diff --git a/test/sequence/swap.cpp b/test/sequence/swap.cpp index 7df7b822..50c2381d 100644 --- a/test/sequence/swap.cpp +++ b/test/sequence/swap.cpp @@ -22,7 +22,7 @@ int main() namespace fusion = boost::fusion; { typedef fusion::vector, char> test_vector; - BOOST_MPL_ASSERT((boost::is_same::type>)); + BOOST_MPL_ASSERT((boost::is_same::type>)); test_vector v1(std::vector(1, 101), 'a'), v2(std::vector(1, 202), 'b'); diff --git a/include/boost/fusion/container/ext_/tree.hpp b/test/sequence/tree.hpp old mode 100755 new mode 100644 similarity index 70% rename from include/boost/fusion/container/ext_/tree.hpp rename to test/sequence/tree.hpp index cd8c5dcd..a345a8f1 --- a/include/boost/fusion/container/ext_/tree.hpp +++ b/test/sequence/tree.hpp @@ -18,27 +18,15 @@ #include // for nil #include #include -#include -#include -#include +#include +#include +#include namespace boost { namespace fusion { struct tree_tag; - namespace detail - { - template - struct reference : add_reference {}; - - template - struct reference : reference::type, false> {}; - - template - struct reference : reference {}; - } - - template + template struct tree : sequence_base > { @@ -67,13 +55,13 @@ namespace boost { namespace fusion segments_type segments; }; - template + template tree make_tree(Data const &data) { return tree(data); } - template + template tree make_tree(Data const &data, Left const &left, Right const &right) { return tree(data, left, right); @@ -81,17 +69,17 @@ namespace boost { namespace fusion namespace extension { - template<> + template <> struct is_segmented_impl { - template + template struct apply : mpl::true_ {}; }; - template<> + template <> struct segments_impl { - template + template struct apply { typedef typename mpl::if_< @@ -106,24 +94,6 @@ namespace boost { namespace fusion } }; }; - - template<> - struct begin_impl - { - template - struct apply - : segmented_begin - {}; - }; - - template<> - struct end_impl - { - template - struct apply - : segmented_end - {}; - }; } }} diff --git a/test/sequence/value_at.hpp b/test/sequence/value_at.hpp index d791fb5e..f14afcb2 100644 --- a/test/sequence/value_at.hpp +++ b/test/sequence/value_at.hpp @@ -16,7 +16,7 @@ #endif #if !defined(FUSION_VALUE_AT) -#define FUSION_VALUE_AT(S, N) result_of::value_at_c +#define FUSION_VALUE_AT(S, N) boost::fusion::result_of::value_at_c #endif namespace test_detail diff --git a/test/sequence/vector_n.cpp b/test/sequence/vector_n.cpp index a536affb..dc6028b4 100644 --- a/test/sequence/vector_n.cpp +++ b/test/sequence/vector_n.cpp @@ -42,10 +42,10 @@ main() { typedef vector1 type; type vec; - BOOST_STATIC_ASSERT(result_of::size::value == 1); + BOOST_STATIC_ASSERT(boost::fusion::result_of::size::value == 1); BOOST_TEST(at_c<0>(vec) == 0); - BOOST_STATIC_ASSERT((boost::is_same::type>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::value)); // prove that it is mutable at_c<0>(vec) = 987; @@ -77,13 +77,13 @@ main() { typedef vector2 type; type vec; - BOOST_STATIC_ASSERT(result_of::size::value == 2); + BOOST_STATIC_ASSERT(boost::fusion::result_of::size::value == 2); BOOST_TEST(at_c<0>(vec) == 0); BOOST_TEST(at_c<1>(vec) == char()); - BOOST_STATIC_ASSERT((boost::is_same::type>::value)); - BOOST_STATIC_ASSERT((boost::is_same::type>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::value)); } { @@ -103,15 +103,15 @@ main() { typedef vector3 type; type vec; - BOOST_STATIC_ASSERT(result_of::size::value == 3); + BOOST_STATIC_ASSERT(boost::fusion::result_of::size::value == 3); BOOST_TEST(at_c<0>(vec) == 0); BOOST_TEST(at_c<1>(vec) == char()); BOOST_TEST(at_c<2>(vec) == double()); - BOOST_STATIC_ASSERT((boost::is_same::type>::value)); - BOOST_STATIC_ASSERT((boost::is_same::type>::value)); - BOOST_STATIC_ASSERT((boost::is_same::type>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::value)); } { @@ -147,13 +147,13 @@ main() BOOST_TEST(at_c<5>(vec) >= 5.9 && at_c<5>(vec) <= 6.1); BOOST_TEST(at_c<6>(vec) >= 6.9 && at_c<6>(vec) <= 7.1); - BOOST_STATIC_ASSERT((boost::is_same::type>::value)); - BOOST_STATIC_ASSERT((boost::is_same::type>::value)); - BOOST_STATIC_ASSERT((boost::is_same::type>::value)); - BOOST_STATIC_ASSERT((boost::is_same::type>::value)); - BOOST_STATIC_ASSERT((boost::is_same::type>::value)); - BOOST_STATIC_ASSERT((boost::is_same::type>::value)); - BOOST_STATIC_ASSERT((boost::is_same::type>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::value)); + BOOST_STATIC_ASSERT((boost::is_same::type>::value)); cout << "(bool, char, short, int, long, float, double): " << sizeof(vec) << endl; } diff --git a/test/sequence/zip_view_ignore.cpp b/test/sequence/zip_view_ignore.cpp index 2a300809..d22bf70f 100644 --- a/test/sequence/zip_view_ignore.cpp +++ b/test/sequence/zip_view_ignore.cpp @@ -34,19 +34,19 @@ int main() BOOST_TEST(at_c<0>(back(v)) == 2); BOOST_TEST(at_c<2>(back(v)) == 'b'); - typedef result_of::begin::type first_iterator; - typedef result_of::value_of::type first_element; + typedef boost::fusion::result_of::begin::type first_iterator; + typedef boost::fusion::result_of::value_of::type first_element; - typedef result_of::at_c::type e0; - typedef result_of::at_c::type e2; + typedef boost::fusion::result_of::at_c::type e0; + typedef boost::fusion::result_of::at_c::type e2; BOOST_MPL_ASSERT((boost::is_same)); BOOST_MPL_ASSERT((boost::is_same)); BOOST_TEST(size(front(v)) == 3); - typedef result_of::value_at_c::type first_value_at; - typedef result_of::value_at_c::type v0; - typedef result_of::value_at_c::type v2; + typedef boost::fusion::result_of::value_at_c::type first_value_at; + typedef boost::fusion::result_of::value_at_c::type v0; + typedef boost::fusion::result_of::value_at_c::type v2; BOOST_MPL_ASSERT((boost::is_same)); BOOST_MPL_ASSERT((boost::is_same));