From 39785ddb0e6b3ef83ebf8aaa3e89be3c4005fa31 Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Wed, 17 Oct 2012 18:05:39 +0900 Subject: [PATCH 01/25] Add convert implementation for Boost.Tuple Signed-off-by: Kohei Takahashi --- include/boost/fusion/adapted/boost_tuple.hpp | 1 + .../adapted/boost_tuple/detail/build_cons.hpp | 59 +++++++++++++++++++ .../boost_tuple/detail/convert_impl.hpp | 50 ++++++++++++++++ 3 files changed, 110 insertions(+) create mode 100644 include/boost/fusion/adapted/boost_tuple/detail/build_cons.hpp create mode 100644 include/boost/fusion/adapted/boost_tuple/detail/convert_impl.hpp diff --git a/include/boost/fusion/adapted/boost_tuple.hpp b/include/boost/fusion/adapted/boost_tuple.hpp index 85af5764..a391156d 100644 --- a/include/boost/fusion/adapted/boost_tuple.hpp +++ b/include/boost/fusion/adapted/boost_tuple.hpp @@ -17,5 +17,6 @@ #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 From 219b4124d7306c48f7fbcf2589f527c5373e9849 Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Wed, 17 Oct 2012 19:59:44 +0900 Subject: [PATCH 02/25] Add convert implementation for std::tuple Signed-off-by: Kohei Takahashi --- include/boost/fusion/adapted/std_tuple.hpp | 1 + .../std_tuple/detail/build_std_tuple.hpp | 105 ++++++++++++++++++ .../adapted/std_tuple/detail/convert_impl.hpp | 48 ++++++++ 3 files changed, 154 insertions(+) create mode 100644 include/boost/fusion/adapted/std_tuple/detail/build_std_tuple.hpp create mode 100644 include/boost/fusion/adapted/std_tuple/detail/convert_impl.hpp diff --git a/include/boost/fusion/adapted/std_tuple.hpp b/include/boost/fusion/adapted/std_tuple.hpp index 984a4df4..3716d73b 100644 --- a/include/boost/fusion/adapted/std_tuple.hpp +++ b/include/boost/fusion/adapted/std_tuple.hpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include 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 From 38bcd6e779ae06ff7da2aba1066307d9f3666dc1 Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Wed, 17 Oct 2012 18:05:39 +0900 Subject: [PATCH 03/25] Add mpl::clear implementation for Boost.Tuple Signed-off-by: Kohei Takahashi --- include/boost/fusion/adapted/boost_tuple.hpp | 1 + .../fusion/adapted/boost_tuple/mpl/clear.hpp | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 include/boost/fusion/adapted/boost_tuple/mpl/clear.hpp diff --git a/include/boost/fusion/adapted/boost_tuple.hpp b/include/boost/fusion/adapted/boost_tuple.hpp index a391156d..7ef65686 100644 --- a/include/boost/fusion/adapted/boost_tuple.hpp +++ b/include/boost/fusion/adapted/boost_tuple.hpp @@ -18,5 +18,6 @@ #include #include #include +#include #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 From f5fe438f14a6a4b58fa3e8758f53b32fd2d5ecf1 Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Wed, 17 Oct 2012 19:59:44 +0900 Subject: [PATCH 04/25] Add mpl::clear implementation for std::tuple Signed-off-by: Kohei Takahashi --- include/boost/fusion/adapted/std_tuple.hpp | 1 + .../fusion/adapted/std_tuple/mpl/clear.hpp | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 include/boost/fusion/adapted/std_tuple/mpl/clear.hpp diff --git a/include/boost/fusion/adapted/std_tuple.hpp b/include/boost/fusion/adapted/std_tuple.hpp index 3716d73b..b7e84791 100644 --- a/include/boost/fusion/adapted/std_tuple.hpp +++ b/include/boost/fusion/adapted/std_tuple.hpp @@ -19,5 +19,6 @@ #include #include #include +#include #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 From f7adae2b3d4cfa205c680f4c663c9bfc12410081 Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Thu, 29 May 2014 02:24:26 +0900 Subject: [PATCH 05/25] Add test for convert seq to tuple Signed-off-by: Kohei Takahashi --- test/sequence/boost_tuple.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 From 059c0416599827fbc6c71d45d95d23191953676e Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Sun, 8 Jun 2014 02:47:06 +0900 Subject: [PATCH 06/25] Add test for convert seq to std::tuple Signed-off-by: Kohei Takahashi --- test/Jamfile | 1 + test/sequence/std_tuple.cpp | 47 +++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 test/sequence/std_tuple.cpp diff --git a/test/Jamfile b/test/Jamfile index 1c84637d..73c4e89a 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -150,6 +150,7 @@ 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_iterator.cpp : : : : ] [ run sequence/ref_vector.cpp : : : : ] [ run sequence/flatten_view.cpp : : : : ] diff --git a/test/sequence/std_tuple.cpp b/test/sequence/std_tuple.cpp new file mode 100644 index 00000000..3ac6e387 --- /dev/null +++ b/test/sequence/std_tuple.cpp @@ -0,0 +1,47 @@ +/*============================================================================= + 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 + +#if !defined(BOOST_NO_CXX11_HDR_TUPLE) + +#include +#include +#include +#include +#include +#include +#include + +int +main() +{ + using namespace boost::fusion; + using namespace boost; + +// The convert only supports implementations using variadic templates +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + { + // 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!!!"); + } +#endif + + return boost::report_errors(); +} + +#else + +int +main() +{ + return 0; +} + +#endif From 25bb75e3f826754f3d250bff1d6deeb4aab0911b Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Thu, 12 Jun 2014 01:18:20 +0900 Subject: [PATCH 07/25] Fix test error in msvc-10.0 Including fusion/adapted/std_tuple.hpp will occur compile error. Therefore, entire test should be ignored. Signed-off-by: Kohei Takahashi --- test/sequence/std_tuple.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/sequence/std_tuple.cpp b/test/sequence/std_tuple.cpp index 3ac6e387..2495fa55 100644 --- a/test/sequence/std_tuple.cpp +++ b/test/sequence/std_tuple.cpp @@ -7,7 +7,9 @@ #include -#if !defined(BOOST_NO_CXX11_HDR_TUPLE) +// 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 @@ -23,15 +25,12 @@ main() using namespace boost::fusion; using namespace boost; -// The convert only supports implementations using variadic templates -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) { // 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!!!"); } -#endif return boost::report_errors(); } From f7685b119433486f1eb208dedfd3efed53361f2f Mon Sep 17 00:00:00 2001 From: fiesh Date: Thu, 24 Jul 2014 14:22:55 +0200 Subject: [PATCH 08/25] add automatic hash function creation --- doc/sequence.qbk | 82 ++++++++++++++++++++++++++ include/boost/fusion/include/hash.hpp | 12 ++++ include/boost/fusion/sequence/hash.hpp | 42 +++++++++++++ test/Jamfile | 5 ++ test/sequence/deque_hash.cpp | 16 +++++ test/sequence/hash.cpp | 58 ++++++++++++++++++ test/sequence/hash.hpp | 34 +++++++++++ test/sequence/list_hash.cpp | 16 +++++ test/sequence/tuple_hash.cpp | 16 +++++ test/sequence/vector_hash.cpp | 16 +++++ 10 files changed, 297 insertions(+) create mode 100644 include/boost/fusion/include/hash.hpp create mode 100644 include/boost/fusion/sequence/hash.hpp create mode 100644 test/sequence/deque_hash.cpp create mode 100644 test/sequence/hash.cpp create mode 100644 test/sequence/hash.hpp create mode 100644 test/sequence/list_hash.cpp create mode 100644 test/sequence/tuple_hash.cpp create mode 100644 test/sequence/vector_hash.cpp diff --git a/doc/sequence.qbk b/doc/sequence.qbk index 9e27f1c8..2fc6f4c2 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,87 @@ compile time error. [endsect] +[section Hashing] + +Automatically create a [classref 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); + } + +[endsect] + [endsect] [endsect] 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/sequence/hash.hpp b/include/boost/fusion/sequence/hash.hpp new file mode 100644 index 00000000..53430961 --- /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/test/Jamfile b/test/Jamfile index 73c4e89a..e89c3017 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,6 +115,7 @@ 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 : : : : ] @@ -124,6 +128,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 : : : : ] 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..b1692bf7 --- /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/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(); +} From 70410d1e07ae46baea17d20179df2ddbc63d1736 Mon Sep 17 00:00:00 2001 From: fiesh Date: Thu, 24 Jul 2014 14:45:45 +0200 Subject: [PATCH 09/25] replaced tabs with 4 spaces --- include/boost/fusion/sequence/hash.hpp | 42 ++++++++--------- test/sequence/hash.cpp | 64 +++++++++++++------------- 2 files changed, 53 insertions(+), 53 deletions(-) diff --git a/include/boost/fusion/sequence/hash.hpp b/include/boost/fusion/sequence/hash.hpp index 53430961..bc5b1499 100644 --- a/include/boost/fusion/sequence/hash.hpp +++ b/include/boost/fusion/sequence/hash.hpp @@ -14,29 +14,29 @@ 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; - } - }; + 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()); - } - } + 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; + using hashing::hash_value; }} #endif diff --git a/test/sequence/hash.cpp b/test/sequence/hash.cpp index b1692bf7..3740bf55 100644 --- a/test/sequence/hash.cpp +++ b/test/sequence/hash.cpp @@ -13,46 +13,46 @@ struct test_struct { - test_struct(bool bb, int ii, char cc, std::string const& ss) : - b(bb), - i(ii), - c(cc), - s(ss) {} + 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; + bool b; + int i; + char c; + std::string s; }; BOOST_FUSION_ADAPT_STRUCT( - test_struct, - (bool, b) - (int, i) - (char, c) - (std::string, s) + test_struct, + (bool, b) + (int, i) + (char, c) + (std::string, s) ) int main() { - using boost::fusion::hash_value; + 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"); + 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)); + 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)); } From d71cf19e0f375cada73950c8182ff88488d54b25 Mon Sep 17 00:00:00 2001 From: fiesh Date: Thu, 24 Jul 2014 17:44:37 +0200 Subject: [PATCH 10/25] fix documentation, introduce "See also" block --- doc/fusion.qbk | 1 + doc/sequence.qbk | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) 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 2fc6f4c2..69899f8d 100644 --- a/doc/sequence.qbk +++ b/doc/sequence.qbk @@ -1899,7 +1899,7 @@ compile time error. [section Hashing] -Automatically create a [classref boost::hash] conforming `hash_value` function. +Automatically create a `boost::hash` conforming `hash_value` function. [heading Synopsis] @@ -1976,6 +1976,10 @@ returning a type that is convertible to `std::size_t`. assert(set.count(key) == 0); } +[heading See also] + +__boost_func_hash__ + [endsect] [endsect] From c2abefbab8a2c181a7efd172ad36eaad6b6d9265 Mon Sep 17 00:00:00 2001 From: gnzlbg Date: Fri, 30 May 2014 16:39:00 +0200 Subject: [PATCH 11/25] Initial constexpr support This allows to use, e.g., boost::fusion::fold within constexpr functions. The BOOST_CONSTEXPR macro is used to declare functions constexpr. --- .../fusion/adapted/mpl/detail/at_impl.hpp | 2 +- .../fusion/adapted/mpl/detail/begin_impl.hpp | 2 +- .../fusion/adapted/mpl/detail/end_impl.hpp | 2 +- .../boost/fusion/adapted/mpl/mpl_iterator.hpp | 10 ++--- .../algorithm/iteration/detail/fold.hpp | 22 +++++------ .../iteration/detail/preprocessed/fold.hpp | 22 +++++------ .../fusion/algorithm/iteration/fold_fwd.hpp | 8 ++-- include/boost/fusion/iterator/advance.hpp | 4 +- .../boost/fusion/iterator/basic_iterator.hpp | 10 ++--- include/boost/fusion/iterator/deref.hpp | 4 +- include/boost/fusion/iterator/deref_data.hpp | 2 +- .../iterator/detail/adapt_deref_traits.hpp | 2 +- .../boost/fusion/iterator/detail/advance.hpp | 8 ++-- .../boost/fusion/iterator/detail/distance.hpp | 2 +- .../iterator/detail/segment_sequence.hpp | 4 +- .../iterator/detail/segmented_iterator.hpp | 8 ++-- .../iterator/detail/segmented_next_impl.hpp | 20 +++++----- include/boost/fusion/iterator/distance.hpp | 2 +- include/boost/fusion/iterator/equal_to.hpp | 4 +- .../fusion/iterator/iterator_adapter.hpp | 10 ++--- .../fusion/iterator/mpl/convert_iterator.hpp | 6 +-- include/boost/fusion/iterator/next.hpp | 2 +- include/boost/fusion/iterator/prior.hpp | 2 +- .../boost/fusion/sequence/intrinsic/at.hpp | 8 ++-- .../fusion/sequence/intrinsic/at_key.hpp | 6 +-- .../boost/fusion/sequence/intrinsic/back.hpp | 4 +- .../boost/fusion/sequence/intrinsic/begin.hpp | 4 +- .../intrinsic/detail/segmented_begin.hpp | 2 +- .../intrinsic/detail/segmented_begin_impl.hpp | 6 +-- .../intrinsic/detail/segmented_end.hpp | 2 +- .../intrinsic/detail/segmented_end_impl.hpp | 2 +- .../boost/fusion/sequence/intrinsic/empty.hpp | 2 +- .../boost/fusion/sequence/intrinsic/end.hpp | 4 +- .../boost/fusion/sequence/intrinsic/front.hpp | 4 +- .../fusion/sequence/intrinsic/has_key.hpp | 2 +- .../fusion/sequence/intrinsic/segments.hpp | 4 +- .../boost/fusion/sequence/intrinsic/size.hpp | 2 +- .../boost/fusion/sequence/intrinsic/swap.hpp | 4 +- .../boost/fusion/sequence/intrinsic_fwd.hpp | 38 +++++++++---------- 39 files changed, 126 insertions(+), 126 deletions(-) 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/algorithm/iteration/detail/fold.hpp b/include/boost/fusion/algorithm/iteration/detail/fold.hpp index 71f60a7c..c8eaf360 100644 --- a/include/boost/fusion/algorithm/iteration/detail/fold.hpp +++ b/include/boost/fusion/algorithm/iteration/detail/fold.hpp @@ -58,7 +58,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) { @@ -104,7 +104,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) { @@ -135,7 +135,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) { @@ -153,7 +153,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 +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&, F) { @@ -345,7 +345,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 +369,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 +404,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 +419,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 +434,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 +449,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..e717fba8 100644 --- a/include/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp +++ b/include/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp @@ -24,7 +24,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& it0,F f) { @@ -65,7 +65,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& it0,F f) { @@ -92,7 +92,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& it0,F f) { @@ -107,7 +107,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& it0,F f) { @@ -119,7 +119,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) { @@ -282,7 +282,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 +302,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 +334,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 +348,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 +362,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 +376,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/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/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/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..4debbf78 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_CONSTEXPR BOOST_FUSION_GPU_ENABLED void operator()(Elem const& e) const { using std::swap; @@ -50,7 +50,7 @@ namespace boost { namespace fusion { } template - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename enable_if, traits::is_sequence >, void>::type swap(Seq1& lhs, Seq2& rhs) { 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); }} From b6c2e9e10bc13fa5de6bed202556d5f209150d8d Mon Sep 17 00:00:00 2001 From: Daniel James Date: Mon, 18 Aug 2014 14:59:22 +0100 Subject: [PATCH 12/25] Add metadata file. --- meta/libraries.json | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 meta/libraries.json 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 " + ] +} From f869aa1591c6d48decef1d8817060e2bf5f2cbaf Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Sat, 27 Sep 2014 13:22:56 +0100 Subject: [PATCH 13/25] Change to test std::tuple now that Boost.TR1 is deprecated and due to be removed. --- test/sequence/tr1_tuple_auto_conv.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/sequence/tr1_tuple_auto_conv.cpp b/test/sequence/tr1_tuple_auto_conv.cpp index 010d4c71..d3aa62b9 100644 --- a/test/sequence/tr1_tuple_auto_conv.cpp +++ b/test/sequence/tr1_tuple_auto_conv.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include #include @@ -7,10 +7,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 +40,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 +50,7 @@ namespace Core int main() { - std::tr1::tuple test = Core::Demo(); + std::tuple test = Core::Demo(); return 0; } From 790810757aa694ee6f33d1e4a177908887029deb Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Wed, 8 Oct 2014 23:55:29 +0900 Subject: [PATCH 14/25] Rename the test tr1_tuple_auto_conv to std_tuple_auto_conv. Signed-off-by: Kohei Takahashi --- test/Jamfile | 2 +- .../{tr1_tuple_auto_conv.cpp => std_tuple_auto_conv.cpp} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename test/sequence/{tr1_tuple_auto_conv.cpp => std_tuple_auto_conv.cpp} (100%) diff --git a/test/Jamfile b/test/Jamfile index e89c3017..ecd391c0 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -117,7 +117,6 @@ project [ 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 : : : : ] @@ -156,6 +155,7 @@ project [ 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/tr1_tuple_auto_conv.cpp b/test/sequence/std_tuple_auto_conv.cpp similarity index 100% rename from test/sequence/tr1_tuple_auto_conv.cpp rename to test/sequence/std_tuple_auto_conv.cpp From b8c65b976ca47791ebfafdc7d6c92710d05a57c1 Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Wed, 8 Oct 2014 23:57:55 +0900 Subject: [PATCH 15/25] Fix test error on non-c++11 env. Signed-off-by: Kohei Takahashi --- test/sequence/std_tuple_auto_conv.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/sequence/std_tuple_auto_conv.cpp b/test/sequence/std_tuple_auto_conv.cpp index d3aa62b9..ebd83910 100644 --- a/test/sequence/std_tuple_auto_conv.cpp +++ b/test/sequence/std_tuple_auto_conv.cpp @@ -1,3 +1,8 @@ +#include + +#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && \ + !defined(BOOST_NO_CXX11_SMART_PTR) + #include #include #include @@ -54,3 +59,12 @@ int main() return 0; } +#else + +int main() +{ + return 0; +} + +#endif + From 73f058b381f10190cbbe6c27bc78268107be171f Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Fri, 17 Oct 2014 17:35:30 +0900 Subject: [PATCH 16/25] Fix include guard mismatch. Signed-off-by: Kohei Takahashi --- include/boost/fusion/view/repetitive_view/repetitive_view.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From bcc2530f1941ad18802b4ae9623cc69166e20aa0 Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Fri, 17 Oct 2014 16:44:57 +0900 Subject: [PATCH 17/25] Do not expand BOOST_{CXX14_}CONSTEXPR while preprocessing. Signed-off-by: Kohei Takahashi --- .../detail/preprocessed/iter_fold.hpp | 22 +++++++++---------- .../detail/preprocessed/reverse_fold.hpp | 22 +++++++++---------- .../detail/preprocessed/reverse_iter_fold.hpp | 22 +++++++++---------- preprocess/wave.cfg | 2 ++ 4 files changed, 35 insertions(+), 33 deletions(-) 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..f936acb1 100644 --- a/include/boost/fusion/algorithm/iteration/detail/preprocessed/iter_fold.hpp +++ b/include/boost/fusion/algorithm/iteration/detail/preprocessed/iter_fold.hpp @@ -23,7 +23,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& it0,F f) { @@ -64,7 +64,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& it0,F f) { @@ -91,7 +91,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& it0,F f) { @@ -106,7 +106,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& it0,F f) { @@ -118,7 +118,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 +281,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 +301,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 +333,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 +347,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 +361,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 +375,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..4413ee45 100644 --- a/include/boost/fusion/algorithm/iteration/detail/preprocessed/reverse_fold.hpp +++ b/include/boost/fusion/algorithm/iteration/detail/preprocessed/reverse_fold.hpp @@ -23,7 +23,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& it0,F f) { @@ -64,7 +64,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& it0,F f) { @@ -91,7 +91,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& it0,F f) { @@ -106,7 +106,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& it0,F f) { @@ -118,7 +118,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 +281,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 +301,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 +333,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 +347,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 +361,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 +375,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..e3020e26 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 @@ -23,7 +23,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& it0,F f) { @@ -64,7 +64,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& it0,F f) { @@ -91,7 +91,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& it0,F f) { @@ -106,7 +106,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& it0,F f) { @@ -118,7 +118,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 +281,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 +301,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 +333,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 +347,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 +361,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 +375,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/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 From badf3f2a4796c961c7a261a3d25780e175971fda Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Fri, 17 Oct 2014 18:40:57 +0900 Subject: [PATCH 18/25] Fix forward declaration in conflict with constexpr. Signed-off-by: Kohei Takahashi --- .../boost/fusion/algorithm/iteration/iter_fold_fwd.hpp | 8 ++++---- .../boost/fusion/algorithm/iteration/reverse_fold_fwd.hpp | 8 ++++---- .../fusion/algorithm/iteration/reverse_iter_fold_fwd.hpp | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) 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 From fdb659819449d5fdc2b9f555febd10c7ae52a245 Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Fri, 17 Oct 2014 18:50:43 +0900 Subject: [PATCH 19/25] Make fold as a single return stmt due to C++11 constexpr. Signed-off-by: Kohei Takahashi --- .../algorithm/iteration/detail/fold.hpp | 131 ++++++++++-------- .../iteration/detail/preprocessed/fold.hpp | 118 +++++++++------- .../detail/preprocessed/iter_fold.hpp | 118 +++++++++------- .../detail/preprocessed/reverse_fold.hpp | 118 +++++++++------- .../detail/preprocessed/reverse_iter_fold.hpp | 118 +++++++++------- 5 files changed, 340 insertions(+), 263 deletions(-) diff --git a/include/boost/fusion/algorithm/iteration/detail/fold.hpp b/include/boost/fusion/algorithm/iteration/detail/fold.hpp index c8eaf360..c6bc2eeb 100644 --- a/include/boost/fusion/algorithm/iteration/detail/fold.hpp +++ b/include/boost/fusion/algorithm/iteration/detail/fold.hpp @@ -57,39 +57,11 @@ namespace boost { namespace fusion template struct BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME) { - template + 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 - 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 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) { - 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 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_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_1(State1 const& state1,It1 const& it1,F& f) + { + return f(state1,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it1)); + } + template 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); } }; diff --git a/include/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp b/include/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp index e717fba8..9b27815b 100644 --- a/include/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp +++ b/include/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp @@ -23,35 +23,11 @@ namespace boost { namespace fusion template struct unrolled_fold { - template + 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,47 +36,87 @@ namespace boost { namespace fusion fusion::next(it3), 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 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) { - 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 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_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_1(State1 const& state1,It1 const& it1,F& f) + { + return f(state1,fusion::deref(it1)); + } template 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 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 f936acb1..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 + 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,47 +35,87 @@ namespace boost { namespace fusion fusion::next(it3), 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 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) { - 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 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_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_1(State1 const& state1,It1 const& it1,F& f) + { + return f(state1,it1); + } template 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 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 4413ee45..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 + 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,47 +35,87 @@ namespace boost { namespace fusion fusion::prior(it3), 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 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) { - 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 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_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_1(State1 const& state1,It1 const& it1,F& f) + { + return f(state1,fusion::deref(it1)); + } template 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 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 e3020e26..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 + 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,47 +35,87 @@ namespace boost { namespace fusion fusion::prior(it3), 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 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) { - 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 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_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_1(State1 const& state1,It1 const& it1,F& f) + { + return f(state1,it1); + } template 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 From bebd553dd66792a14989cc98499385883c08d234 Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Fri, 17 Oct 2014 18:51:51 +0900 Subject: [PATCH 20/25] Use BOOST_CXX14_CONSTEXPR instead of BOOST_CONSTEXPR. Signed-off-by: Kohei Takahashi --- include/boost/fusion/sequence/intrinsic/swap.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/boost/fusion/sequence/intrinsic/swap.hpp b/include/boost/fusion/sequence/intrinsic/swap.hpp index 4debbf78..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_CONSTEXPR 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_CONSTEXPR 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; From 3d19bf9d96cd329359f9dae36aaf967514051a7b Mon Sep 17 00:00:00 2001 From: Joel de Guzman Date: Mon, 20 Oct 2014 05:55:48 +0800 Subject: [PATCH 21/25] fixes ticket 10676. for now, we'll use tr1_result_of. we'll have to do an overhaul of the fold implementation because making it sfinae friendly goes deep down into the low level internals. --- include/boost/fusion/algorithm/iteration/detail/fold.hpp | 4 ++-- .../fusion/algorithm/iteration/detail/preprocessed/fold.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/boost/fusion/algorithm/iteration/detail/fold.hpp b/include/boost/fusion/algorithm/iteration/detail/fold.hpp index c8eaf360..00161d99 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< + : boost::tr1_result_of< F( typename add_reference::type>::type, BOOST_FUSION_FOLD_IMPL_INVOKE_IT_META_TRANSFORM(It)) @@ -314,7 +314,7 @@ namespace boost { namespace fusion { typedef typename BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_FOLD_NAME)< - typename boost::result_of< + typename boost::tr1_result_of< F( StateRef, BOOST_FUSION_FOLD_IMPL_INVOKE_IT_META_TRANSFORM( diff --git a/include/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp b/include/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp index e717fba8..434c9d66 100644 --- a/include/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp +++ b/include/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp @@ -257,7 +257,7 @@ namespace boost { namespace fusion { typedef typename result_of_unrolled_fold< - typename boost::result_of< + typename boost::tr1_result_of< F( StateRef, typename fusion::result_of::deref< It0 const>::type From 6cad6bef99e6a67882b0f3f1a91d9573e3de8e9a Mon Sep 17 00:00:00 2001 From: Joel de Guzman Date: Mon, 20 Oct 2014 06:23:52 +0800 Subject: [PATCH 22/25] fixes ticket #10443. invoke is now sfinae friendly. --- .../fusion/functional/invocation/invoke.hpp | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/include/boost/fusion/functional/invocation/invoke.hpp b/include/boost/fusion/functional/invocation/invoke.hpp index d4aa9456..6e64d1d2 100644 --- a/include/boost/fusion/functional/invocation/invoke.hpp +++ b/include/boost/fusion/functional/invocation/invoke.hpp @@ -54,7 +54,8 @@ namespace boost { namespace fusion { namespace result_of { - template struct invoke; + template + struct invoke; } //~ template @@ -75,7 +76,8 @@ namespace boost { namespace fusion 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,7 +106,7 @@ namespace boost { namespace fusion Sequence, N, RandomAccess > { }; - template + template struct invoke_impl : mpl::if_< ft::is_member_function_pointer, invoke_mem_fn, @@ -112,7 +114,7 @@ namespace boost { namespace fusion >::type { }; - template + template struct invoke_impl : mpl::eval_if< ft::is_member_pointer, mpl::if_< ft::is_member_function_pointer, @@ -156,7 +158,14 @@ namespace boost { namespace fusion namespace result_of { - template struct invoke + template + struct invoke; + + template + struct invoke::type, Sequence + >::result_type> { typedef typename detail::invoke_impl< typename boost::remove_reference::type, Sequence @@ -195,13 +204,15 @@ 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> { 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 From 812e9e379e13c75c0955fc7ca68ddabf6ecc252d Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Wed, 22 Oct 2014 01:02:39 +0900 Subject: [PATCH 23/25] Fix wrong partial specializations. Signed-off-by: Kohei Takahashi --- include/boost/fusion/functional/invocation/invoke.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/fusion/functional/invocation/invoke.hpp b/include/boost/fusion/functional/invocation/invoke.hpp index 6e64d1d2..a3ddd4a2 100644 --- a/include/boost/fusion/functional/invocation/invoke.hpp +++ b/include/boost/fusion/functional/invocation/invoke.hpp @@ -107,7 +107,7 @@ namespace boost { namespace fusion { }; template - struct invoke_impl + struct invoke_impl : mpl::if_< ft::is_member_function_pointer, invoke_mem_fn, invoke_nonmember_builtin @@ -115,7 +115,7 @@ namespace boost { namespace fusion { }; template - struct invoke_impl + struct invoke_impl : mpl::eval_if< ft::is_member_pointer, mpl::if_< ft::is_member_function_pointer, invoke_mem_fn, From e014a1d1737994310634fc5f459f0e3dc62bf22b Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Wed, 22 Oct 2014 19:42:48 +0900 Subject: [PATCH 24/25] Fix #10443 completely. Signed-off-by: Kohei Takahashi --- .../fusion/functional/invocation/invoke.hpp | 42 +++++++++++-------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/include/boost/fusion/functional/invocation/invoke.hpp b/include/boost/fusion/functional/invocation/invoke.hpp index a3ddd4a2..2de4fced 100644 --- a/include/boost/fusion/functional/invocation/invoke.hpp +++ b/include/boost/fusion/functional/invocation/invoke.hpp @@ -52,11 +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 @@ -72,6 +73,8 @@ 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, @@ -158,18 +161,14 @@ namespace boost { namespace fusion namespace result_of { - template - struct invoke; - - template - struct invoke::type, Sequence - >::result_type> + template ::type, Sequence + >::result_type> + struct invoke { - typedef typename detail::invoke_impl< - typename boost::remove_reference::type, Sequence - >::result_type type; + typedef Enable type; }; } @@ -208,7 +207,9 @@ namespace boost { namespace fusion template struct invoke_impl::type> + typename always_void_< + typename boost::result_of::type + >::type> { public: @@ -299,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; From c704efb49c95f9d451d624668a7a469aed493c3c Mon Sep 17 00:00:00 2001 From: Joel de Guzman Date: Mon, 27 Oct 2014 19:45:38 +0800 Subject: [PATCH 25/25] correct fix for ticket 10676. this is a temporary fix until we overhaul the fold implementation. --- .../algorithm/iteration/detail/fold.hpp | 4 +- .../iteration/detail/preprocessed/fold.hpp | 4 +- .../boost/fusion/algorithm/iteration/fold.hpp | 1 + .../boost/fusion/support/detail/result_of.hpp | 42 +++++++++++++++++++ 4 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 include/boost/fusion/support/detail/result_of.hpp diff --git a/include/boost/fusion/algorithm/iteration/detail/fold.hpp b/include/boost/fusion/algorithm/iteration/detail/fold.hpp index afa99026..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::tr1_result_of< + : fusion::detail::result_of_with_decltype< F( typename add_reference::type>::type, BOOST_FUSION_FOLD_IMPL_INVOKE_IT_META_TRANSFORM(It)) @@ -327,7 +327,7 @@ namespace boost { namespace fusion { typedef typename BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_FOLD_NAME)< - typename boost::tr1_result_of< + typename fusion::detail::result_of_with_decltype< F( StateRef, BOOST_FUSION_FOLD_IMPL_INVOKE_IT_META_TRANSFORM( diff --git a/include/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp b/include/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp index 5456a0d7..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) @@ -273,7 +273,7 @@ namespace boost { namespace fusion { typedef typename result_of_unrolled_fold< - typename boost::tr1_result_of< + typename fusion::detail::result_of_with_decltype< F( StateRef, typename fusion::result_of::deref< It0 const>::type 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/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