diff --git a/doc/fusion.qbk b/doc/fusion.qbk index dce0e3f1..8edf9be1 100644 --- a/doc/fusion.qbk +++ b/doc/fusion.qbk @@ -53,6 +53,7 @@ [def __boost_shared_ptr_call__ [@http://www.boost.org/libs/smart_ptr/shared_ptr.htm `boost::shared_ptr`]] [def __boost_func_forward__ [@http://www.boost.org/libs/functional/forward/doc/html/index.html Boost.Functional/Forward]] [def __boost_func_factory__ [@http://www.boost.org/libs/functional/factory/doc/html/index.html Boost.Functional/Factory]] +[def __boost_func_hash__ [@http://www.boost.org/doc/html/hash.html Boost.Functional/Hash]] [def __std_pair_doc__ [@http://www.sgi.com/tech/stl/pair.html `std::pair`]] [def __std_plus_doc__ [@http://www.sgi.com/tech/stl/plus.html `std::plus`]] [def __std_minus_doc__ [@http://www.sgi.com/tech/stl/minus.html `std::minus`]] diff --git a/doc/sequence.qbk b/doc/sequence.qbk index 9e27f1c8..69899f8d 100644 --- a/doc/sequence.qbk +++ b/doc/sequence.qbk @@ -1,6 +1,7 @@ [/============================================================================== Copyright (C) 2001-2011 Joel de Guzman Copyright (C) 2006 Dan Marsden + Copyright (C) 2014 Christoph Weiss Use, modification and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -1896,6 +1897,91 @@ compile time error. [endsect] +[section Hashing] + +Automatically create a `boost::hash` conforming `hash_value` function. + +[heading Synopsis] + + template + std::size_t + hash_value(Seq const& seq); + +[heading Parameters] + +[table + [[Parameter] [Requirement] [Description]] + [[`seq`] [Instance of __sequence__] [__sequence__ to compute hash value of]] +] + +[*Return type]: `std::size_t` + +[*Requirements]: + +For each element `e` in sequence `seq`, `hash_value(seq)` is a valid expression +returning a type that is convertible to `std::size_t`. + +[*Semantics]: Returns a combined hash value for all elements of `seq`. + +[heading Header] + + #include + #include + +[heading Example] + + #include + #include + #include + #include + + void foo() + { + typedef boost::fusion::vector Vec; + const Vec v = {42, "Hello World", 't'}; + // Compute a hash value directly. + std::cout << "hash_value(v) = " << boost::fusion::hash_value(v) << '\n'; + // Or use it to create an unordered_map. + boost::unordered_map map; + map[v] = true; + assert(map.size() == 1 && map.count(v) == 1); + } + +[heading Example] + + #include + #include + #include + #include + + // We would like to define a struct that we can form unordered_sets of. + BOOST_FUSION_DEFINE_STRUCT( + (demo), Key, + (bool, b) + (std::string, s) + (int, i) + ) + + namespace demo { + // Make operator== and hash_value ADL accessible. + using boost::fusion::operator==; + using boost::fusion::hash_value; + typedef boost::unordered_set Set; + } + + void foo() + { + demo::Set set; + demo::Key key; + assert(set.count(key) == 0); + } + +[heading See also] + +__boost_func_hash__ + +[endsect] + [endsect] [endsect] diff --git a/include/boost/fusion/adapted/boost_tuple.hpp b/include/boost/fusion/adapted/boost_tuple.hpp index 85af5764..7ef65686 100644 --- a/include/boost/fusion/adapted/boost_tuple.hpp +++ b/include/boost/fusion/adapted/boost_tuple.hpp @@ -17,5 +17,7 @@ #include #include #include +#include +#include #endif diff --git a/include/boost/fusion/adapted/boost_tuple/detail/build_cons.hpp b/include/boost/fusion/adapted/boost_tuple/detail/build_cons.hpp new file mode 100644 index 00000000..216fb0a6 --- /dev/null +++ b/include/boost/fusion/adapted/boost_tuple/detail/build_cons.hpp @@ -0,0 +1,59 @@ +/*============================================================================= + Copyright (c) 2012-2014 Kohei Takahashi + + 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_BUILD_CONS_10172012_0130) +#define BOOST_FUSION_BUILD_CONS_10172012_0130 + +#include +#include +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + template < + typename First + , typename Last + , bool is_empty = result_of::equal_to::value> + struct build_tuple_cons; + + template + struct build_tuple_cons + { + typedef boost::tuples::null_type type; + + BOOST_FUSION_GPU_ENABLED + static type + call(First const&, Last const&) + { + return type(); + } + }; + + template + struct build_tuple_cons + { + typedef + build_tuple_cons::type, Last> + next_build_tuple_cons; + + typedef boost::tuples::cons< + typename result_of::value_of::type + , typename next_build_tuple_cons::type> + type; + + BOOST_FUSION_GPU_ENABLED + static type + call(First const& f, Last const& l) + { + typename result_of::value_of::type v = *f; + return type(v, next_build_tuple_cons::call(fusion::next(f), l)); + } + }; +}}} + +#endif diff --git a/include/boost/fusion/adapted/boost_tuple/detail/convert_impl.hpp b/include/boost/fusion/adapted/boost_tuple/detail/convert_impl.hpp new file mode 100644 index 00000000..8f2fbeec --- /dev/null +++ b/include/boost/fusion/adapted/boost_tuple/detail/convert_impl.hpp @@ -0,0 +1,50 @@ +/*============================================================================= + Copyright (c) 2012-2014 Kohei Takahashi + + 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_CONVERT_IMPL_10172012_0120) +#define BOOST_FUSION_CONVERT_IMPL_10172012_0120 + +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct boost_tuple_tag; + + namespace extension + { + template + struct convert_impl; + + template <> + struct convert_impl + { + template + struct apply + { + typedef typename + detail::build_tuple_cons< + typename result_of::begin::type + , typename result_of::end::type + > + build_tuple_cons; + + typedef typename build_tuple_cons::type type; + + BOOST_FUSION_GPU_ENABLED + static type + call(Sequence& seq) + { + return build_tuple_cons::call(fusion::begin(seq), fusion::end(seq)); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/adapted/boost_tuple/mpl/clear.hpp b/include/boost/fusion/adapted/boost_tuple/mpl/clear.hpp new file mode 100644 index 00000000..1cca019c --- /dev/null +++ b/include/boost/fusion/adapted/boost_tuple/mpl/clear.hpp @@ -0,0 +1,23 @@ +/*============================================================================= + Copyright (c) 2012 Kohei Takahashi + + 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_CLEAR_10172012_0100) +#define BOOST_FUSION_CLEAR_10172012_0100 + +#include +#include + +namespace boost { namespace fusion { namespace detail { + + template + struct clear; + + template <> + struct clear : mpl::identity > {}; + +}}} + +#endif diff --git a/include/boost/fusion/adapted/mpl/detail/at_impl.hpp b/include/boost/fusion/adapted/mpl/detail/at_impl.hpp index 3fcafaac..232ca4df 100644 --- a/include/boost/fusion/adapted/mpl/detail/at_impl.hpp +++ b/include/boost/fusion/adapted/mpl/detail/at_impl.hpp @@ -28,7 +28,7 @@ namespace boost { namespace fusion { typedef typename mpl::at::type type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Sequence) { diff --git a/include/boost/fusion/adapted/mpl/detail/begin_impl.hpp b/include/boost/fusion/adapted/mpl/detail/begin_impl.hpp index c64e2828..3f087bda 100644 --- a/include/boost/fusion/adapted/mpl/detail/begin_impl.hpp +++ b/include/boost/fusion/adapted/mpl/detail/begin_impl.hpp @@ -33,7 +33,7 @@ namespace boost { namespace fusion { >::type iterator; typedef mpl_iterator type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Sequence) { diff --git a/include/boost/fusion/adapted/mpl/detail/end_impl.hpp b/include/boost/fusion/adapted/mpl/detail/end_impl.hpp index 579e5a69..7ef13fb4 100644 --- a/include/boost/fusion/adapted/mpl/detail/end_impl.hpp +++ b/include/boost/fusion/adapted/mpl/detail/end_impl.hpp @@ -33,7 +33,7 @@ namespace boost { namespace fusion >::type iterator; typedef mpl_iterator type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Sequence) { diff --git a/include/boost/fusion/adapted/mpl/mpl_iterator.hpp b/include/boost/fusion/adapted/mpl/mpl_iterator.hpp index cc037672..43748d98 100644 --- a/include/boost/fusion/adapted/mpl/mpl_iterator.hpp +++ b/include/boost/fusion/adapted/mpl/mpl_iterator.hpp @@ -38,7 +38,7 @@ namespace boost { namespace fusion typename Iterator::iterator_type>::type type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Iterator) { @@ -53,7 +53,7 @@ namespace boost { namespace fusion typename mpl::next::type> type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Iterator) { @@ -68,7 +68,7 @@ namespace boost { namespace fusion typename mpl::prior::type> type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Iterator) { @@ -83,7 +83,7 @@ namespace boost { namespace fusion typename mpl::advance::type> type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Iterator const& /*i*/) { @@ -104,7 +104,7 @@ namespace boost { namespace fusion >::type type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(I1 const&, I2 const&) { diff --git a/include/boost/fusion/adapted/std_tuple.hpp b/include/boost/fusion/adapted/std_tuple.hpp index 984a4df4..b7e84791 100644 --- a/include/boost/fusion/adapted/std_tuple.hpp +++ b/include/boost/fusion/adapted/std_tuple.hpp @@ -16,7 +16,9 @@ #include #include #include +#include #include #include +#include #endif diff --git a/include/boost/fusion/adapted/std_tuple/detail/build_std_tuple.hpp b/include/boost/fusion/adapted/std_tuple/detail/build_std_tuple.hpp new file mode 100644 index 00000000..fd96eabf --- /dev/null +++ b/include/boost/fusion/adapted/std_tuple/detail/build_std_tuple.hpp @@ -0,0 +1,105 @@ +/*============================================================================= + Copyright (c) 2014 Kohei Takahashi + + 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_BUILD_STD_TUPLE_05292014_0100) +#define BOOST_FUSION_BUILD_STD_TUPLE_05292014_0100 + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + template ::value + > + struct build_std_tuple; + + template + struct build_std_tuple + { + typedef std::tuple<> type; + BOOST_FUSION_GPU_ENABLED + static type + call(First const&, Last const&) + { + return type(); + } + }; + + template struct indexed_tuple { }; + + template > + struct make_indexed_tuple; + + template + struct make_indexed_tuple> + { + typedef typename + boost::mpl::eval_if_c< + (Head == 0), + boost::mpl::identity>, + make_indexed_tuple> + >::type + type; + }; + + template + struct push_front_std_tuple; + + template + struct push_front_std_tuple> + { + typedef std::tuple type; + + template + BOOST_FUSION_GPU_ENABLED + static type + indexed_call(T const& first, std::tuple const& rest, indexed_tuple) + { + return type(first, std::get(rest)...); + } + + BOOST_FUSION_GPU_ENABLED + static type + call(T const& first, std::tuple const& rest) + { + typedef typename make_indexed_tuple::type gen; + return indexed_call(first, rest, gen()); + } + }; + + template + struct build_std_tuple + { + typedef + build_std_tuple::type, Last> + next_build_std_tuple; + + typedef push_front_std_tuple< + typename result_of::value_of::type + , typename next_build_std_tuple::type> + push_front; + + typedef typename push_front::type type; + + BOOST_FUSION_GPU_ENABLED + static type + call(First const& f, Last const& l) + { + typename result_of::value_of::type v = *f; + return push_front::call( + v, next_build_std_tuple::call(fusion::next(f), l)); + } + }; +}}} + +#endif diff --git a/include/boost/fusion/adapted/std_tuple/detail/convert_impl.hpp b/include/boost/fusion/adapted/std_tuple/detail/convert_impl.hpp new file mode 100644 index 00000000..ee079bed --- /dev/null +++ b/include/boost/fusion/adapted/std_tuple/detail/convert_impl.hpp @@ -0,0 +1,48 @@ +/*============================================================================= + Copyright (c) 2012-2014 Kohei Takahashi + + 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_CONVERT_IMPL_10172012_0940) +#define BOOST_FUSION_CONVERT_IMPL_10172012_0940 + +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct std_tuple_tag; + + namespace extension + { + template + struct convert_impl; + + template <> + struct convert_impl + { + template + struct apply + { + typedef detail::build_std_tuple< + typename result_of::begin::type + , typename result_of::end::type + > gen; + + typedef typename gen::type type; + + BOOST_FUSION_GPU_ENABLED + static type + call(Sequence& seq) + { + return gen::call(begin(seq), end(seq)); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/adapted/std_tuple/mpl/clear.hpp b/include/boost/fusion/adapted/std_tuple/mpl/clear.hpp new file mode 100644 index 00000000..87123164 --- /dev/null +++ b/include/boost/fusion/adapted/std_tuple/mpl/clear.hpp @@ -0,0 +1,23 @@ +/*============================================================================= + Copyright (c) 2012 Kohei Takahashi + + 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_CLEAR_10172012_0940) +#define BOOST_FUSION_CLEAR_10172012_0940 + +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + template + struct clear; + + template <> + struct clear : mpl::identity > {}; + +}}} + +#endif diff --git a/include/boost/fusion/algorithm/iteration/detail/fold.hpp b/include/boost/fusion/algorithm/iteration/detail/fold.hpp index 71f60a7c..1813bd24 100644 --- a/include/boost/fusion/algorithm/iteration/detail/fold.hpp +++ b/include/boost/fusion/algorithm/iteration/detail/fold.hpp @@ -47,7 +47,7 @@ namespace boost { namespace fusion { template struct BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state) - : boost::result_of< + : fusion::detail::result_of_with_decltype< F( typename add_reference::type>::type, BOOST_FUSION_FOLD_IMPL_INVOKE_IT_META_TRANSFORM(It)) @@ -57,39 +57,11 @@ namespace boost { namespace fusion template struct BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME) { - template - BOOST_FUSION_GPU_ENABLED + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static Result - call(State const& state,It0 const& it0,F f) + call_3(State3 const& state3,It3 const& it3,F& f) { - typedef typename - result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION< - It0 const - >::type - It1; - It1 it1 = fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it0); - typedef typename - result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION< - It1 - >::type - It2; - It2 it2 = fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it1); - typedef typename - result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION< - It2 - >::type - It3; - It3 it3 = fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it2); - - typedef typename BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)::type State1; - State1 const state1=f(state,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it0)); - - typedef typename BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)::type State2; - State2 const state2=f(state1,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it1)); - - typedef typename BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)::type State3; - State3 const state3=f(state2,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it2)); - return BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME)< Result , N-4 @@ -98,54 +70,95 @@ namespace boost { namespace fusion fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it3), f); } + + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static Result + call_2(State2 const& state2,It2 const& it2,F& f) + { + return call_3( + f(state2,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it2)), + fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it2), + f); + } + + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static Result + call_1(State1 const& state1,It1 const& it1,F& f) + { + return call_2( + f(state1,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it1)), + fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it1), + f); + } + + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static Result + call(State const& state,It0 const& it0,F f) + { + return call_1( + f(state,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it0)), + fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it0), + f); + } }; template struct BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME) { + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static Result + call_2(State2 const& state2,It2 const& it2,F& f) + { + return f(state2,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it2)); + } + + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static Result + call_1(State1 const& state1,It1 const& it1,F& f) + { + return call_2( + f(state1,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it1)), + fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it1), + f); + } + template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static Result call(State const& state,It0 const& it0,F f) { - typedef typename - result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION< - It0 const - >::type - It1; - It1 it1 = fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it0); - typedef typename - result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION< - It1 - >::type - It2; - It2 it2 = fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it1); - - typedef typename BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)::type State1; - State1 const state1=f(state,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it0)); - - typedef typename BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)::type State2; - State2 const state2=f(state1,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it1)); - - return f(state2,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it2)); + return call_1( + f(state,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it0)), + fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it0), + f); } }; template struct BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME) { + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static Result + call_1(State1 const& state1,It1 const& it1,F& f) + { + return f(state1,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it1)); + } + template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static Result call(State const& state,It0 const& it0,F f) { - typedef typename BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)::type State1; - State1 const state1=f(state,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it0)); - - return f( - state1, - BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM( - fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it0))); + return call_1( + f(state,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it0)), + fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it0), + f); } }; @@ -153,7 +166,7 @@ namespace boost { namespace fusion struct BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME) { template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static Result call(State const& state,It0 const& it0,F f) { @@ -166,7 +179,7 @@ namespace boost { namespace fusion struct BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME) { template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static Result call(State const& state,It0 const&, F) { @@ -314,7 +327,7 @@ namespace boost { namespace fusion { typedef typename BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_FOLD_NAME)< - typename boost::result_of< + typename fusion::detail::result_of_with_decltype< F( StateRef, BOOST_FUSION_FOLD_IMPL_INVOKE_IT_META_TRANSFORM( @@ -345,7 +358,7 @@ namespace boost { namespace fusion >::type type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(StateRef state, Seq& seq, F f) { @@ -369,7 +382,7 @@ namespace boost { namespace fusion { typedef StateRef type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static StateRef call(StateRef state, Seq&, F) { @@ -404,7 +417,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::BOOST_FUSION_FOLD_NAME< Seq , State const @@ -419,7 +432,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::BOOST_FUSION_FOLD_NAME< Seq const , State const @@ -434,7 +447,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::BOOST_FUSION_FOLD_NAME< Seq , State const @@ -449,7 +462,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::BOOST_FUSION_FOLD_NAME< Seq const , State const diff --git a/include/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp b/include/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp index 140c70b1..bd3b1dbd 100644 --- a/include/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp +++ b/include/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp @@ -14,7 +14,7 @@ namespace boost { namespace fusion { template struct fold_lvalue_state - : boost::result_of< + : fusion::detail::result_of_with_decltype< F( typename add_reference::type>::type, typename fusion::result_of::deref::type) @@ -23,35 +23,11 @@ namespace boost { namespace fusion template struct unrolled_fold { - template - BOOST_FUSION_GPU_ENABLED + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static Result - call(State const& state,It0 const& it0,F f) + call_3(State3 const& state3,It3 const& it3,F& f) { - typedef typename - result_of::next< - It0 const - >::type - It1; - It1 it1 = fusion::next(it0); - typedef typename - result_of::next< - It1 - >::type - It2; - It2 it2 = fusion::next(it1); - typedef typename - result_of::next< - It2 - >::type - It3; - It3 it3 = fusion::next(it2); - typedef typename fold_lvalue_state::type State1; - State1 const state1=f(state,fusion::deref(it0)); - typedef typename fold_lvalue_state::type State2; - State2 const state2=f(state1,fusion::deref(it1)); - typedef typename fold_lvalue_state::type State3; - State3 const state3=f(state2,fusion::deref(it2)); return unrolled_fold< Result , N-4 @@ -60,54 +36,94 @@ namespace boost { namespace fusion fusion::next(it3), f); } + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static Result + call_2(State2 const& state2,It2 const& it2,F& f) + { + return call_3( + f(state2,fusion::deref(it2)), + fusion::next(it2), + f); + } + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static Result + call_1(State1 const& state1,It1 const& it1,F& f) + { + return call_2( + f(state1,fusion::deref(it1)), + fusion::next(it1), + f); + } + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static Result + call(State const& state,It0 const& it0,F f) + { + return call_1( + f(state,fusion::deref(it0)), + fusion::next(it0), + f); + } }; template struct unrolled_fold { + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static Result + call_2(State2 const& state2,It2 const& it2,F& f) + { + return f(state2,fusion::deref(it2)); + } + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static Result + call_1(State1 const& state1,It1 const& it1,F& f) + { + return call_2( + f(state1,fusion::deref(it1)), + fusion::next(it1), + f); + } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static Result call(State const& state,It0 const& it0,F f) { - typedef typename - result_of::next< - It0 const - >::type - It1; - It1 it1 = fusion::next(it0); - typedef typename - result_of::next< - It1 - >::type - It2; - It2 it2 = fusion::next(it1); - typedef typename fold_lvalue_state::type State1; - State1 const state1=f(state,fusion::deref(it0)); - typedef typename fold_lvalue_state::type State2; - State2 const state2=f(state1,fusion::deref(it1)); - return f(state2,fusion::deref(it2)); + return call_1( + f(state,fusion::deref(it0)), + fusion::next(it0), + f); } }; template struct unrolled_fold { + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static Result + call_1(State1 const& state1,It1 const& it1,F& f) + { + return f(state1,fusion::deref(it1)); + } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static Result call(State const& state,It0 const& it0,F f) { - typedef typename fold_lvalue_state::type State1; - State1 const state1=f(state,fusion::deref(it0)); - return f( - state1, - fusion::deref( fusion::next(it0))); + return call_1( + f(state,fusion::deref(it0)), + fusion::next(it0), + f); } }; template struct unrolled_fold { template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static Result call(State const& state,It0 const& it0,F f) { @@ -119,7 +135,7 @@ namespace boost { namespace fusion struct unrolled_fold { template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static Result call(State const& state,It0 const&, F) { @@ -257,7 +273,7 @@ namespace boost { namespace fusion { typedef typename result_of_unrolled_fold< - typename boost::result_of< + typename fusion::detail::result_of_with_decltype< F( StateRef, typename fusion::result_of::deref< It0 const>::type @@ -282,7 +298,7 @@ namespace boost { namespace fusion , SeqSize >::type type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(StateRef state, Seq& seq, F f) { @@ -302,7 +318,7 @@ namespace boost { namespace fusion struct fold_impl<0,StateRef,Seq,F> { typedef StateRef type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static StateRef call(StateRef state, Seq&, F) { @@ -334,7 +350,7 @@ namespace boost { namespace fusion {}; } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::fold< Seq , State const @@ -348,7 +364,7 @@ namespace boost { namespace fusion f); } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::fold< Seq const , State const @@ -362,7 +378,7 @@ namespace boost { namespace fusion f); } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::fold< Seq , State const @@ -376,7 +392,7 @@ namespace boost { namespace fusion f); } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::fold< Seq const , State const diff --git a/include/boost/fusion/algorithm/iteration/detail/preprocessed/iter_fold.hpp b/include/boost/fusion/algorithm/iteration/detail/preprocessed/iter_fold.hpp index 1211550d..b86847ee 100644 --- a/include/boost/fusion/algorithm/iteration/detail/preprocessed/iter_fold.hpp +++ b/include/boost/fusion/algorithm/iteration/detail/preprocessed/iter_fold.hpp @@ -22,35 +22,11 @@ namespace boost { namespace fusion template struct unrolled_iter_fold { - template - BOOST_FUSION_GPU_ENABLED + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static Result - call(State const& state,It0 const& it0,F f) + call_3(State3 const& state3,It3 const& it3,F& f) { - typedef typename - result_of::next< - It0 const - >::type - It1; - It1 it1 = fusion::next(it0); - typedef typename - result_of::next< - It1 - >::type - It2; - It2 it2 = fusion::next(it1); - typedef typename - result_of::next< - It2 - >::type - It3; - It3 it3 = fusion::next(it2); - typedef typename iter_fold_lvalue_state::type State1; - State1 const state1=f(state,it0); - typedef typename iter_fold_lvalue_state::type State2; - State2 const state2=f(state1,it1); - typedef typename iter_fold_lvalue_state::type State3; - State3 const state3=f(state2,it2); return unrolled_iter_fold< Result , N-4 @@ -59,54 +35,94 @@ namespace boost { namespace fusion fusion::next(it3), f); } + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static Result + call_2(State2 const& state2,It2 const& it2,F& f) + { + return call_3( + f(state2,it2), + fusion::next(it2), + f); + } + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static Result + call_1(State1 const& state1,It1 const& it1,F& f) + { + return call_2( + f(state1,it1), + fusion::next(it1), + f); + } + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static Result + call(State const& state,It0 const& it0,F f) + { + return call_1( + f(state,it0), + fusion::next(it0), + f); + } }; template struct unrolled_iter_fold { + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static Result + call_2(State2 const& state2,It2 const& it2,F& f) + { + return f(state2,it2); + } + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static Result + call_1(State1 const& state1,It1 const& it1,F& f) + { + return call_2( + f(state1,it1), + fusion::next(it1), + f); + } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static Result call(State const& state,It0 const& it0,F f) { - typedef typename - result_of::next< - It0 const - >::type - It1; - It1 it1 = fusion::next(it0); - typedef typename - result_of::next< - It1 - >::type - It2; - It2 it2 = fusion::next(it1); - typedef typename iter_fold_lvalue_state::type State1; - State1 const state1=f(state,it0); - typedef typename iter_fold_lvalue_state::type State2; - State2 const state2=f(state1,it1); - return f(state2,it2); + return call_1( + f(state,it0), + fusion::next(it0), + f); } }; template struct unrolled_iter_fold { + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static Result + call_1(State1 const& state1,It1 const& it1,F& f) + { + return f(state1,it1); + } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static Result call(State const& state,It0 const& it0,F f) { - typedef typename iter_fold_lvalue_state::type State1; - State1 const state1=f(state,it0); - return f( - state1, - fusion::next(it0)); + return call_1( + f(state,it0), + fusion::next(it0), + f); } }; template struct unrolled_iter_fold { template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static Result call(State const& state,It0 const& it0,F f) { @@ -118,7 +134,7 @@ namespace boost { namespace fusion struct unrolled_iter_fold { template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static Result call(State const& state,It0 const&, F) { @@ -281,7 +297,7 @@ namespace boost { namespace fusion , SeqSize >::type type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(StateRef state, Seq& seq, F f) { @@ -301,7 +317,7 @@ namespace boost { namespace fusion struct iter_fold_impl<0,StateRef,Seq,F> { typedef StateRef type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static StateRef call(StateRef state, Seq&, F) { @@ -333,7 +349,7 @@ namespace boost { namespace fusion {}; } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::iter_fold< Seq , State const @@ -347,7 +363,7 @@ namespace boost { namespace fusion f); } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::iter_fold< Seq const , State const @@ -361,7 +377,7 @@ namespace boost { namespace fusion f); } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::iter_fold< Seq , State const @@ -375,7 +391,7 @@ namespace boost { namespace fusion f); } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::iter_fold< Seq const , State const diff --git a/include/boost/fusion/algorithm/iteration/detail/preprocessed/reverse_fold.hpp b/include/boost/fusion/algorithm/iteration/detail/preprocessed/reverse_fold.hpp index cc78231a..95122c8e 100644 --- a/include/boost/fusion/algorithm/iteration/detail/preprocessed/reverse_fold.hpp +++ b/include/boost/fusion/algorithm/iteration/detail/preprocessed/reverse_fold.hpp @@ -22,35 +22,11 @@ namespace boost { namespace fusion template struct unrolled_reverse_fold { - template - BOOST_FUSION_GPU_ENABLED + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static Result - call(State const& state,It0 const& it0,F f) + call_3(State3 const& state3,It3 const& it3,F& f) { - typedef typename - result_of::prior< - It0 const - >::type - It1; - It1 it1 = fusion::prior(it0); - typedef typename - result_of::prior< - It1 - >::type - It2; - It2 it2 = fusion::prior(it1); - typedef typename - result_of::prior< - It2 - >::type - It3; - It3 it3 = fusion::prior(it2); - typedef typename reverse_fold_lvalue_state::type State1; - State1 const state1=f(state,fusion::deref(it0)); - typedef typename reverse_fold_lvalue_state::type State2; - State2 const state2=f(state1,fusion::deref(it1)); - typedef typename reverse_fold_lvalue_state::type State3; - State3 const state3=f(state2,fusion::deref(it2)); return unrolled_reverse_fold< Result , N-4 @@ -59,54 +35,94 @@ namespace boost { namespace fusion fusion::prior(it3), f); } + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static Result + call_2(State2 const& state2,It2 const& it2,F& f) + { + return call_3( + f(state2,fusion::deref(it2)), + fusion::prior(it2), + f); + } + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static Result + call_1(State1 const& state1,It1 const& it1,F& f) + { + return call_2( + f(state1,fusion::deref(it1)), + fusion::prior(it1), + f); + } + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static Result + call(State const& state,It0 const& it0,F f) + { + return call_1( + f(state,fusion::deref(it0)), + fusion::prior(it0), + f); + } }; template struct unrolled_reverse_fold { + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static Result + call_2(State2 const& state2,It2 const& it2,F& f) + { + return f(state2,fusion::deref(it2)); + } + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static Result + call_1(State1 const& state1,It1 const& it1,F& f) + { + return call_2( + f(state1,fusion::deref(it1)), + fusion::prior(it1), + f); + } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static Result call(State const& state,It0 const& it0,F f) { - typedef typename - result_of::prior< - It0 const - >::type - It1; - It1 it1 = fusion::prior(it0); - typedef typename - result_of::prior< - It1 - >::type - It2; - It2 it2 = fusion::prior(it1); - typedef typename reverse_fold_lvalue_state::type State1; - State1 const state1=f(state,fusion::deref(it0)); - typedef typename reverse_fold_lvalue_state::type State2; - State2 const state2=f(state1,fusion::deref(it1)); - return f(state2,fusion::deref(it2)); + return call_1( + f(state,fusion::deref(it0)), + fusion::prior(it0), + f); } }; template struct unrolled_reverse_fold { + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static Result + call_1(State1 const& state1,It1 const& it1,F& f) + { + return f(state1,fusion::deref(it1)); + } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static Result call(State const& state,It0 const& it0,F f) { - typedef typename reverse_fold_lvalue_state::type State1; - State1 const state1=f(state,fusion::deref(it0)); - return f( - state1, - fusion::deref( fusion::prior(it0))); + return call_1( + f(state,fusion::deref(it0)), + fusion::prior(it0), + f); } }; template struct unrolled_reverse_fold { template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static Result call(State const& state,It0 const& it0,F f) { @@ -118,7 +134,7 @@ namespace boost { namespace fusion struct unrolled_reverse_fold { template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static Result call(State const& state,It0 const&, F) { @@ -281,7 +297,7 @@ namespace boost { namespace fusion , SeqSize >::type type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(StateRef state, Seq& seq, F f) { @@ -301,7 +317,7 @@ namespace boost { namespace fusion struct reverse_fold_impl<0,StateRef,Seq,F> { typedef StateRef type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static StateRef call(StateRef state, Seq&, F) { @@ -333,7 +349,7 @@ namespace boost { namespace fusion {}; } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::reverse_fold< Seq , State const @@ -347,7 +363,7 @@ namespace boost { namespace fusion f); } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::reverse_fold< Seq const , State const @@ -361,7 +377,7 @@ namespace boost { namespace fusion f); } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::reverse_fold< Seq , State const @@ -375,7 +391,7 @@ namespace boost { namespace fusion f); } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::reverse_fold< Seq const , State const diff --git a/include/boost/fusion/algorithm/iteration/detail/preprocessed/reverse_iter_fold.hpp b/include/boost/fusion/algorithm/iteration/detail/preprocessed/reverse_iter_fold.hpp index 3023a912..3dc434fc 100644 --- a/include/boost/fusion/algorithm/iteration/detail/preprocessed/reverse_iter_fold.hpp +++ b/include/boost/fusion/algorithm/iteration/detail/preprocessed/reverse_iter_fold.hpp @@ -22,35 +22,11 @@ namespace boost { namespace fusion template struct unrolled_reverse_iter_fold { - template - BOOST_FUSION_GPU_ENABLED + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static Result - call(State const& state,It0 const& it0,F f) + call_3(State3 const& state3,It3 const& it3,F& f) { - typedef typename - result_of::prior< - It0 const - >::type - It1; - It1 it1 = fusion::prior(it0); - typedef typename - result_of::prior< - It1 - >::type - It2; - It2 it2 = fusion::prior(it1); - typedef typename - result_of::prior< - It2 - >::type - It3; - It3 it3 = fusion::prior(it2); - typedef typename reverse_iter_fold_lvalue_state::type State1; - State1 const state1=f(state,it0); - typedef typename reverse_iter_fold_lvalue_state::type State2; - State2 const state2=f(state1,it1); - typedef typename reverse_iter_fold_lvalue_state::type State3; - State3 const state3=f(state2,it2); return unrolled_reverse_iter_fold< Result , N-4 @@ -59,54 +35,94 @@ namespace boost { namespace fusion fusion::prior(it3), f); } + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static Result + call_2(State2 const& state2,It2 const& it2,F& f) + { + return call_3( + f(state2,it2), + fusion::prior(it2), + f); + } + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static Result + call_1(State1 const& state1,It1 const& it1,F& f) + { + return call_2( + f(state1,it1), + fusion::prior(it1), + f); + } + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static Result + call(State const& state,It0 const& it0,F f) + { + return call_1( + f(state,it0), + fusion::prior(it0), + f); + } }; template struct unrolled_reverse_iter_fold { + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static Result + call_2(State2 const& state2,It2 const& it2,F& f) + { + return f(state2,it2); + } + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static Result + call_1(State1 const& state1,It1 const& it1,F& f) + { + return call_2( + f(state1,it1), + fusion::prior(it1), + f); + } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static Result call(State const& state,It0 const& it0,F f) { - typedef typename - result_of::prior< - It0 const - >::type - It1; - It1 it1 = fusion::prior(it0); - typedef typename - result_of::prior< - It1 - >::type - It2; - It2 it2 = fusion::prior(it1); - typedef typename reverse_iter_fold_lvalue_state::type State1; - State1 const state1=f(state,it0); - typedef typename reverse_iter_fold_lvalue_state::type State2; - State2 const state2=f(state1,it1); - return f(state2,it2); + return call_1( + f(state,it0), + fusion::prior(it0), + f); } }; template struct unrolled_reverse_iter_fold { + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static Result + call_1(State1 const& state1,It1 const& it1,F& f) + { + return f(state1,it1); + } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static Result call(State const& state,It0 const& it0,F f) { - typedef typename reverse_iter_fold_lvalue_state::type State1; - State1 const state1=f(state,it0); - return f( - state1, - fusion::prior(it0)); + return call_1( + f(state,it0), + fusion::prior(it0), + f); } }; template struct unrolled_reverse_iter_fold { template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static Result call(State const& state,It0 const& it0,F f) { @@ -118,7 +134,7 @@ namespace boost { namespace fusion struct unrolled_reverse_iter_fold { template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static Result call(State const& state,It0 const&, F) { @@ -281,7 +297,7 @@ namespace boost { namespace fusion , SeqSize >::type type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(StateRef state, Seq& seq, F f) { @@ -301,7 +317,7 @@ namespace boost { namespace fusion struct reverse_iter_fold_impl<0,StateRef,Seq,F> { typedef StateRef type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static StateRef call(StateRef state, Seq&, F) { @@ -333,7 +349,7 @@ namespace boost { namespace fusion {}; } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::reverse_iter_fold< Seq , State const @@ -347,7 +363,7 @@ namespace boost { namespace fusion f); } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::reverse_iter_fold< Seq const , State const @@ -361,7 +377,7 @@ namespace boost { namespace fusion f); } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::reverse_iter_fold< Seq , State const @@ -375,7 +391,7 @@ namespace boost { namespace fusion f); } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::reverse_iter_fold< Seq const , State const diff --git a/include/boost/fusion/algorithm/iteration/fold.hpp b/include/boost/fusion/algorithm/iteration/fold.hpp index a83b33b1..a2a0146a 100644 --- a/include/boost/fusion/algorithm/iteration/fold.hpp +++ b/include/boost/fusion/algorithm/iteration/fold.hpp @@ -10,6 +10,7 @@ #define BOOST_FUSION_ALGORITHM_ITERATION_FOLD_HPP #include +#include #include #include #include diff --git a/include/boost/fusion/algorithm/iteration/fold_fwd.hpp b/include/boost/fusion/algorithm/iteration/fold_fwd.hpp index cd8dcd81..5bf9e816 100644 --- a/include/boost/fusion/algorithm/iteration/fold_fwd.hpp +++ b/include/boost/fusion/algorithm/iteration/fold_fwd.hpp @@ -17,7 +17,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename result_of::fold< Seq , State const @@ -26,7 +26,7 @@ namespace boost { namespace fusion fold(Seq& seq, State const& state, F f); template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename result_of::fold< Seq const , State const @@ -35,7 +35,7 @@ namespace boost { namespace fusion fold(Seq const& seq, State const& state, F f); template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename result_of::fold< Seq , State const @@ -44,7 +44,7 @@ namespace boost { namespace fusion fold(Seq& seq, State& state, F f); template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename result_of::fold< Seq const , State const diff --git a/include/boost/fusion/algorithm/iteration/iter_fold_fwd.hpp b/include/boost/fusion/algorithm/iteration/iter_fold_fwd.hpp index 8e4898ba..84aabfde 100644 --- a/include/boost/fusion/algorithm/iteration/iter_fold_fwd.hpp +++ b/include/boost/fusion/algorithm/iteration/iter_fold_fwd.hpp @@ -17,7 +17,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename result_of::iter_fold< Seq , State const @@ -26,7 +26,7 @@ namespace boost { namespace fusion iter_fold(Seq& seq, State const& state, F f); template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename result_of::iter_fold< Seq const , State const @@ -35,7 +35,7 @@ namespace boost { namespace fusion iter_fold(Seq const& seq, State const& state, F f); template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename result_of::iter_fold< Seq , State const @@ -44,7 +44,7 @@ namespace boost { namespace fusion iter_fold(Seq& seq, State& state, F f); template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename result_of::iter_fold< Seq const , State const diff --git a/include/boost/fusion/algorithm/iteration/reverse_fold_fwd.hpp b/include/boost/fusion/algorithm/iteration/reverse_fold_fwd.hpp index c5596e79..82fad70a 100644 --- a/include/boost/fusion/algorithm/iteration/reverse_fold_fwd.hpp +++ b/include/boost/fusion/algorithm/iteration/reverse_fold_fwd.hpp @@ -17,7 +17,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename result_of::reverse_fold< Seq , State const @@ -26,7 +26,7 @@ namespace boost { namespace fusion reverse_fold(Seq& seq, State const& state, F f); template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename result_of::reverse_fold< Seq const , State const @@ -35,7 +35,7 @@ namespace boost { namespace fusion reverse_fold(Seq const& seq, State const& state, F f); template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename result_of::reverse_fold< Seq , State const @@ -44,7 +44,7 @@ namespace boost { namespace fusion reverse_fold(Seq& seq, State& state, F f); template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename result_of::reverse_fold< Seq const , State const diff --git a/include/boost/fusion/algorithm/iteration/reverse_iter_fold_fwd.hpp b/include/boost/fusion/algorithm/iteration/reverse_iter_fold_fwd.hpp index 7b49ea69..9f002419 100644 --- a/include/boost/fusion/algorithm/iteration/reverse_iter_fold_fwd.hpp +++ b/include/boost/fusion/algorithm/iteration/reverse_iter_fold_fwd.hpp @@ -17,7 +17,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename result_of::reverse_iter_fold< Seq , State const @@ -26,7 +26,7 @@ namespace boost { namespace fusion reverse_iter_fold(Seq& seq, State const& state, F f); template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename result_of::reverse_iter_fold< Seq const , State const @@ -35,7 +35,7 @@ namespace boost { namespace fusion reverse_iter_fold(Seq const& seq, State const& state, F f); template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename result_of::reverse_iter_fold< Seq , State const @@ -44,7 +44,7 @@ namespace boost { namespace fusion reverse_iter_fold(Seq& seq, State& state, F f); template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename result_of::reverse_iter_fold< Seq const , State const diff --git a/include/boost/fusion/functional/invocation/invoke.hpp b/include/boost/fusion/functional/invocation/invoke.hpp index d4aa9456..2de4fced 100644 --- a/include/boost/fusion/functional/invocation/invoke.hpp +++ b/include/boost/fusion/functional/invocation/invoke.hpp @@ -52,10 +52,12 @@ namespace boost { namespace fusion { - namespace result_of - { - template struct invoke; - } + //~ namespace result_of + //~ { + //~ template + //~ struct invoke; + //~ } //~ template //~ inline typename result_of::invoke::type @@ -71,11 +73,14 @@ namespace boost { namespace fusion { namespace ft = function_types; + template struct always_void_ { typedef T type; }; + template< typename Function, class Sequence, int N = result_of::size::value, bool CBI = ft::is_callable_builtin::value, - bool RandomAccess = traits::is_random_access::value + bool RandomAccess = traits::is_random_access::value, + typename Enable = void > struct invoke_impl; @@ -104,16 +109,16 @@ namespace boost { namespace fusion Sequence, N, RandomAccess > { }; - template - struct invoke_impl + template + struct invoke_impl : mpl::if_< ft::is_member_function_pointer, invoke_mem_fn, invoke_nonmember_builtin >::type { }; - template - struct invoke_impl + template + struct invoke_impl : mpl::eval_if< ft::is_member_pointer, mpl::if_< ft::is_member_function_pointer, invoke_mem_fn, @@ -156,11 +161,14 @@ namespace boost { namespace fusion namespace result_of { - template struct invoke + template ::type, Sequence + >::result_type> + struct invoke { - typedef typename detail::invoke_impl< - typename boost::remove_reference::type, Sequence - >::result_type type; + typedef Enable type; }; } @@ -195,13 +203,17 @@ namespace boost { namespace fusion /////////////////////////////////////////////////////////////////////////////// #define N BOOST_PP_ITERATION() +#define M(z,j,data) typename result_of::at_c::type + template - struct invoke_impl + struct invoke_impl::type + >::type> { public: typedef typename boost::result_of< -#define M(z,j,data) typename result_of::at_c::type Function(BOOST_PP_ENUM(N,M,~)) >::type result_type; #undef M @@ -288,7 +300,12 @@ namespace boost { namespace fusion fusion::next(BOOST_PP_CAT(i,BOOST_PP_DEC(j))); template - struct invoke_impl + struct invoke_impl::BOOST_PP_CAT(T, j) + typename boost::result_of::type + >::type> +#undef L { private: typedef invoke_param_types seq; diff --git a/include/boost/fusion/include/hash.hpp b/include/boost/fusion/include/hash.hpp new file mode 100644 index 00000000..8f483fc6 --- /dev/null +++ b/include/boost/fusion/include/hash.hpp @@ -0,0 +1,12 @@ +/*============================================================================= + Copyright (c) 2014 Christoph Weiss + + 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_INCLUDE_HASH) +#define FUSION_INCLUDE_HASH + +#include + +#endif diff --git a/include/boost/fusion/iterator/advance.hpp b/include/boost/fusion/iterator/advance.hpp index 69b46427..f81596a7 100644 --- a/include/boost/fusion/iterator/advance.hpp +++ b/include/boost/fusion/iterator/advance.hpp @@ -75,7 +75,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::advance_c::type const advance_c(Iterator const& i) { @@ -83,7 +83,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::advance::type const advance(Iterator const& i) { diff --git a/include/boost/fusion/iterator/basic_iterator.hpp b/include/boost/fusion/iterator/basic_iterator.hpp index bab6a4a6..0630c05e 100644 --- a/include/boost/fusion/iterator/basic_iterator.hpp +++ b/include/boost/fusion/iterator/basic_iterator.hpp @@ -77,7 +77,7 @@ namespace boost { namespace fusion basic_iterator type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(It const& it) { @@ -100,7 +100,7 @@ namespace boost { namespace fusion { typedef mpl::minus type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(It1 const&, It2 const&) @@ -121,18 +121,18 @@ namespace boost { namespace fusion {}; template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED basic_iterator(basic_iterator const& it) : seq(it.seq) {} - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED basic_iterator(Seq& in_seq, int) : seq(&in_seq) {} template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED basic_iterator& operator=(basic_iterator const& it) { diff --git a/include/boost/fusion/iterator/deref.hpp b/include/boost/fusion/iterator/deref.hpp index a608b0a0..b6fee6a5 100644 --- a/include/boost/fusion/iterator/deref.hpp +++ b/include/boost/fusion/iterator/deref.hpp @@ -55,7 +55,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename result_of::deref::type deref(Iterator const& i) { @@ -64,7 +64,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename result_of::deref::type operator*(iterator_base const& i) { diff --git a/include/boost/fusion/iterator/deref_data.hpp b/include/boost/fusion/iterator/deref_data.hpp index 0dff0309..20d82ebf 100644 --- a/include/boost/fusion/iterator/deref_data.hpp +++ b/include/boost/fusion/iterator/deref_data.hpp @@ -40,7 +40,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename result_of::deref_data::type deref_data(It const& it) { diff --git a/include/boost/fusion/iterator/detail/adapt_deref_traits.hpp b/include/boost/fusion/iterator/detail/adapt_deref_traits.hpp index ef600556..bee0934f 100644 --- a/include/boost/fusion/iterator/detail/adapt_deref_traits.hpp +++ b/include/boost/fusion/iterator/detail/adapt_deref_traits.hpp @@ -21,7 +21,7 @@ namespace boost { namespace fusion { namespace detail result_of::deref::type type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Iterator const& i) { diff --git a/include/boost/fusion/iterator/detail/advance.hpp b/include/boost/fusion/iterator/detail/advance.hpp index ace4ed49..7eb3bbbd 100644 --- a/include/boost/fusion/iterator/detail/advance.hpp +++ b/include/boost/fusion/iterator/detail/advance.hpp @@ -45,7 +45,7 @@ namespace boost { namespace fusion { namespace advance_detail >::type type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type const& call(type const& i) { @@ -53,7 +53,7 @@ namespace boost { namespace fusion { namespace advance_detail } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(I const& i) { @@ -86,7 +86,7 @@ namespace boost { namespace fusion { namespace advance_detail >::type type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type const& call(type const& i) { @@ -94,7 +94,7 @@ namespace boost { namespace fusion { namespace advance_detail } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(I const& i) { diff --git a/include/boost/fusion/iterator/detail/distance.hpp b/include/boost/fusion/iterator/detail/distance.hpp index c0379952..69849026 100644 --- a/include/boost/fusion/iterator/detail/distance.hpp +++ b/include/boost/fusion/iterator/detail/distance.hpp @@ -53,7 +53,7 @@ namespace boost { namespace fusion { namespace distance_detail >::type type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(First const&, Last const&) { diff --git a/include/boost/fusion/iterator/detail/segment_sequence.hpp b/include/boost/fusion/iterator/detail/segment_sequence.hpp index 90db25ea..8b8d5c13 100644 --- a/include/boost/fusion/iterator/detail/segment_sequence.hpp +++ b/include/boost/fusion/iterator/detail/segment_sequence.hpp @@ -30,7 +30,7 @@ namespace boost { namespace fusion { namespace detail typedef Sequence sequence_type; sequence_type sequence; - BOOST_FUSION_GPU_ENABLED explicit segment_sequence(Sequence const & seq) + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED explicit segment_sequence(Sequence const & seq) : sequence(seq) {} }; @@ -61,7 +61,7 @@ namespace extension { typedef typename Sequence::sequence_type type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Sequence & seq) { return seq.sequence; diff --git a/include/boost/fusion/iterator/detail/segmented_iterator.hpp b/include/boost/fusion/iterator/detail/segmented_iterator.hpp index 1d4f62d3..9e114155 100644 --- a/include/boost/fusion/iterator/detail/segmented_iterator.hpp +++ b/include/boost/fusion/iterator/detail/segmented_iterator.hpp @@ -35,7 +35,7 @@ namespace boost { namespace fusion struct segmented_iterator : iterator_facade, forward_traversal_tag> { - BOOST_FUSION_GPU_ENABLED explicit segmented_iterator(Context const& ctx) + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED explicit segmented_iterator(Context const& ctx) : context(ctx) {} @@ -52,7 +52,7 @@ namespace boost { namespace fusion >::type type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(It const& it) { return *it.context.car.first; @@ -72,7 +72,7 @@ namespace boost { namespace fusion >::type type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(It const& it) { return fusion::deref_data(it.context.car.first); @@ -132,7 +132,7 @@ namespace boost { namespace fusion typedef detail::segmented_next_impl impl; typedef segmented_iterator type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(It const& it) { return type(impl::call(it.context)); diff --git a/include/boost/fusion/iterator/detail/segmented_next_impl.hpp b/include/boost/fusion/iterator/detail/segmented_next_impl.hpp index a2b75d71..62502cee 100644 --- a/include/boost/fusion/iterator/detail/segmented_next_impl.hpp +++ b/include/boost/fusion/iterator/detail/segmented_next_impl.hpp @@ -65,7 +65,7 @@ namespace boost { namespace fusion cons type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Stack const & stack) { return type( @@ -98,7 +98,7 @@ namespace boost { namespace fusion typedef segmented_next_impl_recurse impl; typedef typename impl::type type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Stack const & stack) { return impl::call(stack.cdr); @@ -112,7 +112,7 @@ namespace boost { namespace fusion typedef iterator_range range_type; typedef cons type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Stack const & stack) { return type(range_type(stack.car.last, stack.car.last)); @@ -147,7 +147,7 @@ namespace boost { namespace fusion typedef segmented_next_impl_recurse3 impl; typedef typename impl::type type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Stack const & stack) { return impl::call(stack); @@ -159,7 +159,7 @@ namespace boost { namespace fusion { typedef Result type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Stack const & stack) { return segmented_begin_impl::call(*stack.car.first, stack); @@ -185,7 +185,7 @@ namespace boost { namespace fusion typename segmented_next_impl_recurse::type type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Stack const& stack) { return segmented_next_impl_recurse::call(stack.cdr); @@ -197,7 +197,7 @@ namespace boost { namespace fusion { typedef Next type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Stack const & stack) { return pop_front_car::call(stack); @@ -210,7 +210,7 @@ namespace boost { namespace fusion typedef segmented_next_impl_recurse2 impl; typedef typename impl::type type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Stack const & stack) { return impl::call(pop_front_car::call(stack)); @@ -236,7 +236,7 @@ namespace boost { namespace fusion typedef segmented_next_impl_recurse impl; typedef typename impl::type type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Stack const & stack) { return impl::call(stack.cdr); @@ -248,7 +248,7 @@ namespace boost { namespace fusion { typedef Next type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Stack const & stack) { return pop_front_car::call(stack); diff --git a/include/boost/fusion/iterator/distance.hpp b/include/boost/fusion/iterator/distance.hpp index afca6a36..7f993c0d 100644 --- a/include/boost/fusion/iterator/distance.hpp +++ b/include/boost/fusion/iterator/distance.hpp @@ -69,7 +69,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::distance::type distance(First const& a, Last const& b) { diff --git a/include/boost/fusion/iterator/equal_to.hpp b/include/boost/fusion/iterator/equal_to.hpp index 1927ce7e..191795e1 100644 --- a/include/boost/fusion/iterator/equal_to.hpp +++ b/include/boost/fusion/iterator/equal_to.hpp @@ -74,7 +74,7 @@ namespace boost { namespace fusion namespace iterator_operators { template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename boost::enable_if< mpl::and_, is_fusion_iterator > @@ -86,7 +86,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename boost::enable_if< mpl::and_, is_fusion_iterator > diff --git a/include/boost/fusion/iterator/iterator_adapter.hpp b/include/boost/fusion/iterator/iterator_adapter.hpp index af6978b2..28ea0b6c 100644 --- a/include/boost/fusion/iterator/iterator_adapter.hpp +++ b/include/boost/fusion/iterator/iterator_adapter.hpp @@ -24,7 +24,7 @@ namespace boost { namespace fusion iterator_base_type; iterator_base_type iterator_base; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED iterator_adapter(iterator_base_type const& iterator_base_) : iterator_base(iterator_base_) {} @@ -47,7 +47,7 @@ namespace boost { namespace fusion >::type>::type type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Iterator const& it) { @@ -82,7 +82,7 @@ namespace boost { namespace fusion >::type type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Iterator const& it) { @@ -100,7 +100,7 @@ namespace boost { namespace fusion >::type>::type type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Iterator const& i) { @@ -118,7 +118,7 @@ namespace boost { namespace fusion >::type>::type type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Iterator const& i) { diff --git a/include/boost/fusion/iterator/mpl/convert_iterator.hpp b/include/boost/fusion/iterator/mpl/convert_iterator.hpp index 54c9ef69..3e17478e 100644 --- a/include/boost/fusion/iterator/mpl/convert_iterator.hpp +++ b/include/boost/fusion/iterator/mpl/convert_iterator.hpp @@ -31,21 +31,21 @@ namespace boost { namespace fusion >::type type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static T const& call(T const& x, mpl::true_) { return x; } - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static mpl_iterator call(T const& /*x*/, mpl::false_) { return mpl_iterator(); } - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static typename mpl::if_< is_fusion_iterator diff --git a/include/boost/fusion/iterator/next.hpp b/include/boost/fusion/iterator/next.hpp index bd76eac1..20d3df94 100644 --- a/include/boost/fusion/iterator/next.hpp +++ b/include/boost/fusion/iterator/next.hpp @@ -54,7 +54,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename result_of::next::type const next(Iterator const& i) { diff --git a/include/boost/fusion/iterator/prior.hpp b/include/boost/fusion/iterator/prior.hpp index 78d8390b..a3541280 100644 --- a/include/boost/fusion/iterator/prior.hpp +++ b/include/boost/fusion/iterator/prior.hpp @@ -54,7 +54,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename result_of::prior::type const prior(Iterator const& i) { diff --git a/include/boost/fusion/sequence/hash.hpp b/include/boost/fusion/sequence/hash.hpp new file mode 100644 index 00000000..bc5b1499 --- /dev/null +++ b/include/boost/fusion/sequence/hash.hpp @@ -0,0 +1,42 @@ +/*============================================================================= + Copyright (c) 2014 Christoph Weiss + + 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_HASH_23072014_1017) +#define FUSION_HASH_23072014_1017 + +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + namespace hashing + { + struct hash_combine_fold + { + typedef std::size_t result_type; + template + inline std::size_t operator()(std::size_t seed, T const& v) + { + boost::hash_combine(seed, v); + return seed; + } + }; + + template + inline typename + boost::enable_if, std::size_t>::type + hash_value(Seq const& seq) + { + return fold(seq, 0, hash_combine_fold()); + } + } + + using hashing::hash_value; +}} + +#endif diff --git a/include/boost/fusion/sequence/intrinsic/at.hpp b/include/boost/fusion/sequence/intrinsic/at.hpp index aa0d9744..b2b012b1 100644 --- a/include/boost/fusion/sequence/intrinsic/at.hpp +++ b/include/boost/fusion/sequence/intrinsic/at.hpp @@ -72,7 +72,7 @@ namespace boost { namespace fusion template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename lazy_disable_if< is_const @@ -84,7 +84,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::at::type at(Sequence const& seq) { @@ -92,7 +92,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename lazy_disable_if< is_const @@ -104,7 +104,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::at_c::type at_c(Sequence const& seq) { diff --git a/include/boost/fusion/sequence/intrinsic/at_key.hpp b/include/boost/fusion/sequence/intrinsic/at_key.hpp index 844de840..4693a905 100644 --- a/include/boost/fusion/sequence/intrinsic/at_key.hpp +++ b/include/boost/fusion/sequence/intrinsic/at_key.hpp @@ -38,7 +38,7 @@ namespace boost { namespace fusion >::type type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Seq& seq) { @@ -74,7 +74,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename lazy_disable_if< is_const @@ -86,7 +86,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::at_key::type at_key(Sequence const& seq) { diff --git a/include/boost/fusion/sequence/intrinsic/back.hpp b/include/boost/fusion/sequence/intrinsic/back.hpp index f9343553..3f998a7d 100644 --- a/include/boost/fusion/sequence/intrinsic/back.hpp +++ b/include/boost/fusion/sequence/intrinsic/back.hpp @@ -27,7 +27,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::back::type back(Sequence& seq) { @@ -35,7 +35,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::back::type back(Sequence const& seq) { diff --git a/include/boost/fusion/sequence/intrinsic/begin.hpp b/include/boost/fusion/sequence/intrinsic/begin.hpp index af4e3122..815d9813 100644 --- a/include/boost/fusion/sequence/intrinsic/begin.hpp +++ b/include/boost/fusion/sequence/intrinsic/begin.hpp @@ -71,7 +71,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename lazy_enable_if< traits::is_sequence @@ -83,7 +83,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename lazy_enable_if< traits::is_sequence diff --git a/include/boost/fusion/sequence/intrinsic/detail/segmented_begin.hpp b/include/boost/fusion/sequence/intrinsic/detail/segmented_begin.hpp index 81d09660..ec20ac41 100644 --- a/include/boost/fusion/sequence/intrinsic/detail/segmented_begin.hpp +++ b/include/boost/fusion/sequence/intrinsic/detail/segmented_begin.hpp @@ -32,7 +32,7 @@ namespace boost { namespace fusion { namespace detail > type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Sequence& seq) { return type( diff --git a/include/boost/fusion/sequence/intrinsic/detail/segmented_begin_impl.hpp b/include/boost/fusion/sequence/intrinsic/detail/segmented_begin_impl.hpp index 2ab46270..12d9e24c 100644 --- a/include/boost/fusion/sequence/intrinsic/detail/segmented_begin_impl.hpp +++ b/include/boost/fusion/sequence/intrinsic/detail/segmented_begin_impl.hpp @@ -38,7 +38,7 @@ namespace boost { namespace fusion { namespace detail typedef cons type; typedef mpl::false_ continue_type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Sequence& seq, State const&, Context const& context, segmented_begin_fun) { return type(range_type(fusion::begin(seq), fusion::end(seq)), context); @@ -64,7 +64,7 @@ namespace boost { namespace fusion { namespace detail typedef typename fold_impl::type type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Sequence& seq, Stack const& stack) { return fold_impl::call(seq, end_impl::call(seq, stack), stack, segmented_begin_fun()); @@ -79,7 +79,7 @@ namespace boost { namespace fusion { namespace detail typedef iterator_range pair_type; typedef cons type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Sequence& seq, Stack stack) { return type(pair_type(fusion::begin(seq), fusion::end(seq)), stack); diff --git a/include/boost/fusion/sequence/intrinsic/detail/segmented_end.hpp b/include/boost/fusion/sequence/intrinsic/detail/segmented_end.hpp index c26865a6..55419ed8 100644 --- a/include/boost/fusion/sequence/intrinsic/detail/segmented_end.hpp +++ b/include/boost/fusion/sequence/intrinsic/detail/segmented_end.hpp @@ -28,7 +28,7 @@ namespace boost { namespace fusion { namespace detail > type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Sequence & seq) { return type( diff --git a/include/boost/fusion/sequence/intrinsic/detail/segmented_end_impl.hpp b/include/boost/fusion/sequence/intrinsic/detail/segmented_end_impl.hpp index 9be15043..619fb3f2 100644 --- a/include/boost/fusion/sequence/intrinsic/detail/segmented_end_impl.hpp +++ b/include/boost/fusion/sequence/intrinsic/detail/segmented_end_impl.hpp @@ -48,7 +48,7 @@ namespace boost { namespace fusion { namespace detail typedef iterator_range pair_type; typedef cons type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Sequence & seq, Stack stack) { end_type end = fusion::end(fusion::segments(seq)); diff --git a/include/boost/fusion/sequence/intrinsic/empty.hpp b/include/boost/fusion/sequence/intrinsic/empty.hpp index 3c8666ab..6a0dbe74 100644 --- a/include/boost/fusion/sequence/intrinsic/empty.hpp +++ b/include/boost/fusion/sequence/intrinsic/empty.hpp @@ -51,7 +51,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::empty::type empty(Sequence const&) { diff --git a/include/boost/fusion/sequence/intrinsic/end.hpp b/include/boost/fusion/sequence/intrinsic/end.hpp index 3e69518e..e60c62ea 100644 --- a/include/boost/fusion/sequence/intrinsic/end.hpp +++ b/include/boost/fusion/sequence/intrinsic/end.hpp @@ -71,7 +71,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename lazy_enable_if< traits::is_sequence @@ -83,7 +83,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename lazy_enable_if< traits::is_sequence diff --git a/include/boost/fusion/sequence/intrinsic/front.hpp b/include/boost/fusion/sequence/intrinsic/front.hpp index 6d939da3..8971298a 100644 --- a/include/boost/fusion/sequence/intrinsic/front.hpp +++ b/include/boost/fusion/sequence/intrinsic/front.hpp @@ -26,7 +26,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::front::type front(Sequence& seq) { @@ -34,7 +34,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::front::type front(Sequence const& seq) { diff --git a/include/boost/fusion/sequence/intrinsic/has_key.hpp b/include/boost/fusion/sequence/intrinsic/has_key.hpp index bba2c695..d69a82fb 100644 --- a/include/boost/fusion/sequence/intrinsic/has_key.hpp +++ b/include/boost/fusion/sequence/intrinsic/has_key.hpp @@ -68,7 +68,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::has_key::type has_key(Sequence const&) { diff --git a/include/boost/fusion/sequence/intrinsic/segments.hpp b/include/boost/fusion/sequence/intrinsic/segments.hpp index a1bbacaf..41501a96 100644 --- a/include/boost/fusion/sequence/intrinsic/segments.hpp +++ b/include/boost/fusion/sequence/intrinsic/segments.hpp @@ -54,7 +54,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename lazy_disable_if< is_const @@ -67,7 +67,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::segments::type segments(Sequence const& seq) { diff --git a/include/boost/fusion/sequence/intrinsic/size.hpp b/include/boost/fusion/sequence/intrinsic/size.hpp index 51e613f6..1119980d 100644 --- a/include/boost/fusion/sequence/intrinsic/size.hpp +++ b/include/boost/fusion/sequence/intrinsic/size.hpp @@ -78,7 +78,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::size::type size(Sequence const&) { diff --git a/include/boost/fusion/sequence/intrinsic/swap.hpp b/include/boost/fusion/sequence/intrinsic/swap.hpp index 05ce9b44..6eca3146 100644 --- a/include/boost/fusion/sequence/intrinsic/swap.hpp +++ b/include/boost/fusion/sequence/intrinsic/swap.hpp @@ -40,7 +40,7 @@ namespace boost { namespace fusion { }; template - BOOST_FUSION_GPU_ENABLED + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED void operator()(Elem const& e) const { using std::swap; @@ -50,8 +50,8 @@ namespace boost { namespace fusion { } template - BOOST_FUSION_GPU_ENABLED - typename enable_if, traits::is_sequence >, void>::type + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED + typename enable_if, traits::is_sequence >, void>::type swap(Seq1& lhs, Seq2& rhs) { typedef vector references; diff --git a/include/boost/fusion/sequence/intrinsic_fwd.hpp b/include/boost/fusion/sequence/intrinsic_fwd.hpp index 3b248a04..a6354ea3 100644 --- a/include/boost/fusion/sequence/intrinsic_fwd.hpp +++ b/include/boost/fusion/sequence/intrinsic_fwd.hpp @@ -93,7 +93,7 @@ namespace boost { namespace fusion } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename lazy_disable_if< is_const @@ -102,12 +102,12 @@ namespace boost { namespace fusion at(Sequence& seq); template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename result_of::at::type at(Sequence const& seq); template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename lazy_disable_if< is_const @@ -116,22 +116,22 @@ namespace boost { namespace fusion at_c(Sequence& seq); template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename result_of::at_c::type at_c(Sequence const& seq); template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename result_of::back::type back(Sequence& seq); template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename result_of::back::type back(Sequence const& seq); template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename lazy_enable_if< traits::is_sequence @@ -140,7 +140,7 @@ namespace boost { namespace fusion begin(Sequence& seq); template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename lazy_enable_if< traits::is_sequence @@ -149,12 +149,12 @@ namespace boost { namespace fusion begin(Sequence const& seq); template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename result_of::empty::type empty(Sequence const&); template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename lazy_enable_if< traits::is_sequence @@ -163,7 +163,7 @@ namespace boost { namespace fusion end(Sequence& seq); template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename lazy_enable_if< traits::is_sequence @@ -172,22 +172,22 @@ namespace boost { namespace fusion end(Sequence const& seq); template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename result_of::front::type front(Sequence& seq); template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename result_of::front::type front(Sequence const& seq); template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename result_of::has_key::type has_key(Sequence const& seq); template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename lazy_disable_if< is_const @@ -196,17 +196,17 @@ namespace boost { namespace fusion segments(Sequence& seq); template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename result_of::segments::type segments(Sequence const& seq); template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename result_of::size::type size(Sequence const&); template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename lazy_disable_if< is_const @@ -215,7 +215,7 @@ namespace boost { namespace fusion at_key(Sequence& seq); template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename result_of::at_key::type at_key(Sequence const& seq); }} diff --git a/include/boost/fusion/support/detail/result_of.hpp b/include/boost/fusion/support/detail/result_of.hpp new file mode 100644 index 00000000..e15fea5e --- /dev/null +++ b/include/boost/fusion/support/detail/result_of.hpp @@ -0,0 +1,42 @@ +/*============================================================================= + Copyright (c) 2001-2014 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(FUSION_RESULT_OF_10272014_0654) +#define FUSION_RESULT_OF_10272014_0654 + +#include + +namespace boost { namespace fusion { namespace detail +{ + // This is a temporary workaround for result_of before we make fusion fully + // sfinae result_of friendy, which will require some heavy lifting for some + // low level code. So far this is used only in the fold algorithm. This will + // be removed once we overhaul fold. + +#if defined(BOOST_NO_CXX11_DECLTYPE) + + template + struct result_of_with_decltype : boost::tr1_result_of {}; + +#else + + BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type) + BOOST_MPL_HAS_XXX_TEMPLATE_DEF(result) + + template + struct result_of_with_decltype; + + template + struct result_of_with_decltype + : mpl::if_, detail::has_result>, + boost::tr1_result_of, + boost::detail::cpp0x_result_of>::type {}; + +#endif + +}}} + +#endif diff --git a/include/boost/fusion/view/repetitive_view/repetitive_view.hpp b/include/boost/fusion/view/repetitive_view/repetitive_view.hpp index 89678755..ab0a3b18 100644 --- a/include/boost/fusion/view/repetitive_view/repetitive_view.hpp +++ b/include/boost/fusion/view/repetitive_view/repetitive_view.hpp @@ -5,7 +5,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ -#if !defined(BOOST_FUSION_REPETITIVE_REPETITIVE_VIEW_VIEW_HPP_INCLUDED) +#ifndef BOOST_FUSION_REPETITIVE_VIEW_REPETITIVE_VIEW_HPP_INCLUDED #define BOOST_FUSION_REPETITIVE_VIEW_REPETITIVE_VIEW_HPP_INCLUDED #include diff --git a/meta/libraries.json b/meta/libraries.json new file mode 100644 index 00000000..d60f74e5 --- /dev/null +++ b/meta/libraries.json @@ -0,0 +1,20 @@ +{ + "key": "fusion", + "name": "Fusion", + "authors": [ + "Joel de Guzman", + "Dan Marsden", + "Tobias Schwinger" + ], + "description": "Library for working with tuples, including various containers, algorithms, etc.", + "documentation": "doc/html/", + "category": [ + "Data", + "Metaprogramming" + ], + "maintainers": [ + "Joel de Guzman ", + "Dan Marsden ", + "Tobias Schwinger " + ] +} diff --git a/preprocess/wave.cfg b/preprocess/wave.cfg index 35a6881a..3cde502f 100644 --- a/preprocess/wave.cfg +++ b/preprocess/wave.cfg @@ -10,6 +10,8 @@ -D_M_IX86 -NBOOST_STATIC_ASSERT -NBOOST_FORCEINLINE +-NBOOST_CONSTEXPR +-NBOOST_CXX14_CONSTEXPR -NBOOST_MPL_ASSERT -NBOOST_MPL_ASSERT_MSG -NBOOST_MPL_ASSERT_RELATION diff --git a/test/Jamfile b/test/Jamfile index 1c84637d..ecd391c0 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -63,6 +63,7 @@ project [ run sequence/boost_tuple.cpp : : : : ] [ run sequence/cons.cpp : : : : ] [ run sequence/filter_view.cpp : : : : ] + [ run sequence/hash.cpp : : : : ] [ run sequence/io.cpp : : : : ] [ run sequence/iterator_range.cpp : : : : ] [ run sequence/joint_view.cpp : : : : ] @@ -70,6 +71,7 @@ project [ run sequence/list_construction.cpp : : : : ] [ run sequence/list_copy.cpp : : : : ] [ run sequence/list_iterator.cpp : : : : ] + [ run sequence/list_hash.cpp : : : : ] [ run sequence/list_make.cpp : : : : ] [ run sequence/list_misc.cpp : : : : ] [ run sequence/list_mutate.cpp : : : : ] @@ -79,6 +81,7 @@ project [ run sequence/deque_construction.cpp : : : : ] [ run sequence/deque_copy.cpp : : : : ] [ run sequence/deque_iterator.cpp : : : : ] + [ run sequence/deque_hash.cpp : : : : ] [ run sequence/deque_make.cpp : : : : ] [ run sequence/deque_misc.cpp : : : : ] [ run sequence/deque_move.cpp : : : : ] @@ -112,8 +115,8 @@ project [ run sequence/tuple_make.cpp : : : : ] [ run sequence/tuple_misc.cpp : : : : ] [ run sequence/tuple_mutate.cpp : : : : ] + [ run sequence/tuple_hash.cpp : : : : ] [ run sequence/tuple_tie.cpp : : : : ] - [ run sequence/tr1_tuple_auto_conv.cpp : : : : ] [ run sequence/transform_view.cpp : : : : ] [ run sequence/vector_comparison.cpp : : : : ] [ run sequence/vector_construction.cpp : : : : ] @@ -124,6 +127,7 @@ project [ run sequence/vector_move.cpp : : : : ] [ run sequence/vector_mutate.cpp : : : : ] [ run sequence/vector_n.cpp : : : : ] + [ run sequence/vector_hash.cpp : : : : ] [ run sequence/vector_tie.cpp : : : : ] [ run sequence/vector_value_at.cpp : : : : ] [ run sequence/zip_view.cpp : : : : ] @@ -150,6 +154,8 @@ project [ run sequence/define_tpl_struct.cpp : : : : ] [ run sequence/define_tpl_struct_inline.cpp : : : : ] [ run sequence/define_assoc_tpl_struct.cpp : : : : ] + [ run sequence/std_tuple.cpp : : : : ] + [ run sequence/std_tuple_auto_conv.cpp : : : : ] [ run sequence/std_tuple_iterator.cpp : : : : ] [ run sequence/ref_vector.cpp : : : : ] [ run sequence/flatten_view.cpp : : : : ] diff --git a/test/sequence/boost_tuple.cpp b/test/sequence/boost_tuple.cpp index c16c0894..7d19ffef 100644 --- a/test/sequence/boost_tuple.cpp +++ b/test/sequence/boost_tuple.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -87,7 +88,14 @@ main() fusion::list l(tuples::make_tuple(123, "Hola!!!")); l = tuples::make_tuple(123, "Hola!!!"); } - + + { + // conversion vector to boost tuple + boost::tuple t = convert(make_vector(123, "Hola!!!")); + BOOST_TEST(get<0>(t) == 123); + BOOST_TEST(get<1>(t) == "Hola!!!"); + } + { // test from Ticket #1601, submitted by Shunsuke Sogame // expanded by Stjepan Rajko diff --git a/test/sequence/deque_hash.cpp b/test/sequence/deque_hash.cpp new file mode 100644 index 00000000..01b36660 --- /dev/null +++ b/test/sequence/deque_hash.cpp @@ -0,0 +1,16 @@ +/*============================================================================= + Copyright (c) 2014 Christoph Weiss + + 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 + +#define FUSION_SEQUENCE deque +#include "hash.hpp" + +int main() +{ + hash_test(); + return boost::report_errors(); +} diff --git a/test/sequence/hash.cpp b/test/sequence/hash.cpp new file mode 100644 index 00000000..3740bf55 --- /dev/null +++ b/test/sequence/hash.cpp @@ -0,0 +1,58 @@ +/*============================================================================= + Copyright (c) 2014 Christoph Weiss + + 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 + +struct test_struct +{ + test_struct(bool bb, int ii, char cc, std::string const& ss) : + b(bb), + i(ii), + c(cc), + s(ss) {} + + bool b; + int i; + char c; + std::string s; +}; + +BOOST_FUSION_ADAPT_STRUCT( + test_struct, + (bool, b) + (int, i) + (char, c) + (std::string, s) +) + +int main() +{ + using boost::fusion::hash_value; + + const test_struct a0(false, 1, 'c', "Hello Nurse"), + a1(false, 1, 'c', "Hello Nurse"), + b(true, 1, 'c', "Hello Nurse"), + c(false, 0, 'c', "Hello Nurse"), + d(false, 1, 'd', "Hello Nurse"), + e(false, 1, 'c', "Hello World"); + + BOOST_TEST(hash_value(a0) == hash_value(a1)); + BOOST_TEST(hash_value(a0) != hash_value(b)); + BOOST_TEST(hash_value(a0) != hash_value(c)); + BOOST_TEST(hash_value(a0) != hash_value(d)); + BOOST_TEST(hash_value(a0) != hash_value(e)); + BOOST_TEST(hash_value(b) != hash_value(c)); + BOOST_TEST(hash_value(b) != hash_value(d)); + BOOST_TEST(hash_value(b) != hash_value(d)); + BOOST_TEST(hash_value(c) != hash_value(d)); + BOOST_TEST(hash_value(c) != hash_value(e)); + BOOST_TEST(hash_value(d) != hash_value(e)); +} diff --git a/test/sequence/hash.hpp b/test/sequence/hash.hpp new file mode 100644 index 00000000..7dea0a3f --- /dev/null +++ b/test/sequence/hash.hpp @@ -0,0 +1,34 @@ +/*============================================================================= + Copyright (c) 2014 Christoph Weiss + + 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 + +void +hash_test() +{ + using namespace boost::fusion; + + const FUSION_SEQUENCE v0(42, 'x', false, "Aurea prima"); + const FUSION_SEQUENCE v1(42, 'x', false, "Aurea prima"); + BOOST_TEST(hash_value(v0) == hash_value(v1)); + + const FUSION_SEQUENCE w(41, 'x', false, "Aurea prima"); + BOOST_TEST(hash_value(w) != hash_value(v0)); + + const FUSION_SEQUENCE x(42, 'y', false, "Aurea prima"); + BOOST_TEST(hash_value(x) != hash_value(v0)); + + const FUSION_SEQUENCE y(42, 'x', true, "Aurea prima"); + BOOST_TEST(hash_value(y) != hash_value(v0)); + + const FUSION_SEQUENCE z(42, 'x', false, "quae vindice nullo"); + BOOST_TEST(hash_value(z) != hash_value(v0)); +} diff --git a/test/sequence/list_hash.cpp b/test/sequence/list_hash.cpp new file mode 100644 index 00000000..51203b27 --- /dev/null +++ b/test/sequence/list_hash.cpp @@ -0,0 +1,16 @@ +/*============================================================================= + Copyright (c) 2014 Christoph Weiss + + 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 + +#define FUSION_SEQUENCE list +#include "hash.hpp" + +int main() +{ + hash_test(); + return boost::report_errors(); +} diff --git a/test/sequence/std_tuple.cpp b/test/sequence/std_tuple.cpp new file mode 100644 index 00000000..2495fa55 --- /dev/null +++ b/test/sequence/std_tuple.cpp @@ -0,0 +1,46 @@ +/*============================================================================= + Copyright (c) 2014 Kohei Takahashi + + 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 + +// adapted/std_tuple.hpp only supports implementations using variadic templates +#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && \ + !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + +#include +#include +#include +#include +#include +#include +#include + +int +main() +{ + using namespace boost::fusion; + using namespace boost; + + { + // conversion vector to std tuple + std::tuple t = convert(make_vector(123, "Hola!!!")); + BOOST_TEST(std::get<0>(t) == 123); + BOOST_TEST(std::get<1>(t) == "Hola!!!"); + } + + return boost::report_errors(); +} + +#else + +int +main() +{ + return 0; +} + +#endif diff --git a/test/sequence/tr1_tuple_auto_conv.cpp b/test/sequence/std_tuple_auto_conv.cpp similarity index 65% rename from test/sequence/tr1_tuple_auto_conv.cpp rename to test/sequence/std_tuple_auto_conv.cpp index 010d4c71..ebd83910 100644 --- a/test/sequence/tr1_tuple_auto_conv.cpp +++ b/test/sequence/std_tuple_auto_conv.cpp @@ -1,5 +1,10 @@ -#include -#include +#include + +#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && \ + !defined(BOOST_NO_CXX11_SMART_PTR) + +#include +#include #include #include @@ -7,10 +12,10 @@ namespace Core { class AutoConverter { - std::tr1::shared_ptr t_; + std::shared_ptr t_; public: - AutoConverter(std::tr1::shared_ptr const & t) + AutoConverter(std::shared_ptr const & t) : t_(t) {} @@ -40,8 +45,8 @@ namespace Core inline AutoConverter Demo() { - std::tr1::shared_ptr p_result - (new boost::any(std::tr1::make_tuple(1, 2, 3, 4))); + std::shared_ptr p_result + (new boost::any(std::make_tuple(1, 2, 3, 4))); return p_result; } @@ -50,7 +55,16 @@ namespace Core int main() { - std::tr1::tuple test = Core::Demo(); + std::tuple test = Core::Demo(); return 0; } +#else + +int main() +{ + return 0; +} + +#endif + diff --git a/test/sequence/tuple_hash.cpp b/test/sequence/tuple_hash.cpp new file mode 100644 index 00000000..e8f604ef --- /dev/null +++ b/test/sequence/tuple_hash.cpp @@ -0,0 +1,16 @@ +/*============================================================================= + Copyright (c) 2014 Christoph Weiss + + 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 + +#define FUSION_SEQUENCE tuple +#include "hash.hpp" + +int main() +{ + hash_test(); + return boost::report_errors(); +} diff --git a/test/sequence/vector_hash.cpp b/test/sequence/vector_hash.cpp new file mode 100644 index 00000000..6b6dcd24 --- /dev/null +++ b/test/sequence/vector_hash.cpp @@ -0,0 +1,16 @@ +/*============================================================================= + Copyright (c) 2014 Christoph Weiss + + 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 + +#define FUSION_SEQUENCE vector +#include "hash.hpp" + +int main() +{ + hash_test(); + return boost::report_errors(); +}