From 4835310623eaa521d3ea901e0bde3885a6344186 Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Mon, 3 Nov 2014 04:55:37 +0900 Subject: [PATCH 1/9] Remove unnecessary header, see 5adcb5b --- include/boost/fusion/include/adapt_assoc_class.hpp | 14 -------------- .../fusion/include/adapt_assoc_class_named.hpp | 14 -------------- 2 files changed, 28 deletions(-) delete mode 100644 include/boost/fusion/include/adapt_assoc_class.hpp delete mode 100644 include/boost/fusion/include/adapt_assoc_class_named.hpp diff --git a/include/boost/fusion/include/adapt_assoc_class.hpp b/include/boost/fusion/include/adapt_assoc_class.hpp deleted file mode 100644 index 83d6c4da..00000000 --- a/include/boost/fusion/include/adapt_assoc_class.hpp +++ /dev/null @@ -1,14 +0,0 @@ -/*============================================================================= - Copyright (c) 2010 Christopher Schmidt - - Distributed under the Boost Software License, Version 1.0. (See accompanying - file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -==============================================================================*/ - -#ifndef BOOST_FUSION_INCLUDE_ADAPT_ASSOC_CLASS_HPP -#define BOOST_FUSION_INCLUDE_ADAPT_ASSOC_CLASS_HPP - -#include -#include - -#endif diff --git a/include/boost/fusion/include/adapt_assoc_class_named.hpp b/include/boost/fusion/include/adapt_assoc_class_named.hpp deleted file mode 100644 index 3c04183d..00000000 --- a/include/boost/fusion/include/adapt_assoc_class_named.hpp +++ /dev/null @@ -1,14 +0,0 @@ -/*============================================================================= - Copyright (c) 2010 Christopher Schmidt - - Distributed under the Boost Software License, Version 1.0. (See accompanying - file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -==============================================================================*/ - -#ifndef BOOST_FUSION_INCLUDE_ADAPT_ASSOC_CLASS_NAMED_HPP -#define BOOST_FUSION_INCLUDE_ADAPT_ASSOC_CLASS_NAMED_HPP - -#include -#include - -#endif From 20ee8d192adab3a30401a759526070085ce047aa Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Thu, 23 Oct 2014 16:15:31 +0900 Subject: [PATCH 2/9] Fix missing includes, close ticket #8457. e.g. Now can compile following simple case. #include #include struct null_iterator : iterator_facade {}; struct null_adapter : iterator_adapter {}; --- include/boost/fusion/iterator/iterator_adapter.hpp | 8 +++++++- include/boost/fusion/iterator/iterator_facade.hpp | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/boost/fusion/iterator/iterator_adapter.hpp b/include/boost/fusion/iterator/iterator_adapter.hpp index 28ea0b6c..5b6d44ff 100644 --- a/include/boost/fusion/iterator/iterator_adapter.hpp +++ b/include/boost/fusion/iterator/iterator_adapter.hpp @@ -8,8 +8,14 @@ #define FUSION_ITERATOR_ADAPTER_08112011_0942 #include -#include +#include +#include +#include +#include #include +#include +#include +#include #include namespace boost { namespace fusion diff --git a/include/boost/fusion/iterator/iterator_facade.hpp b/include/boost/fusion/iterator/iterator_facade.hpp index 415e841c..a2c659ab 100644 --- a/include/boost/fusion/iterator/iterator_facade.hpp +++ b/include/boost/fusion/iterator/iterator_facade.hpp @@ -14,6 +14,7 @@ #include #include #include +#include namespace boost { namespace fusion { From a7e9bb2df4290207baa7bfd5b0ec1cc01017bdd1 Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Sun, 26 Oct 2014 18:20:45 +0900 Subject: [PATCH 3/9] Fix to meet constexpr requirements --- include/boost/fusion/iterator/basic_iterator.hpp | 2 +- .../sequence/intrinsic/detail/segmented_end_impl.hpp | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/include/boost/fusion/iterator/basic_iterator.hpp b/include/boost/fusion/iterator/basic_iterator.hpp index 0630c05e..5d484132 100644 --- a/include/boost/fusion/iterator/basic_iterator.hpp +++ b/include/boost/fusion/iterator/basic_iterator.hpp @@ -132,7 +132,7 @@ namespace boost { namespace fusion {} template - BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED basic_iterator& operator=(basic_iterator const& it) { 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 619fb3f2..da48649a 100644 --- a/include/boost/fusion/sequence/intrinsic/detail/segmented_end_impl.hpp +++ b/include/boost/fusion/sequence/intrinsic/detail/segmented_end_impl.hpp @@ -48,11 +48,18 @@ namespace boost { namespace fusion { namespace detail typedef iterator_range pair_type; typedef cons type; + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static pair_type make_pair(end_type end) + { + return pair_type(end, end); + } + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Sequence & seq, Stack stack) { - end_type end = fusion::end(fusion::segments(seq)); - return type(pair_type(end, end), stack); + return type( + make_pair(fusion::end(fusion::segments(seq))), + stack); } }; From 5f416e24fcbf020d3bb3bfd975c2a4e7e94245e6 Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Thu, 6 Nov 2014 09:55:31 +0900 Subject: [PATCH 4/9] Use category_of to get correct iterator category. --- include/boost/fusion/iterator/iterator_adapter.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/boost/fusion/iterator/iterator_adapter.hpp b/include/boost/fusion/iterator/iterator_adapter.hpp index 5b6d44ff..7e860c77 100644 --- a/include/boost/fusion/iterator/iterator_adapter.hpp +++ b/include/boost/fusion/iterator/iterator_adapter.hpp @@ -8,6 +8,7 @@ #define FUSION_ITERATOR_ADAPTER_08112011_0942 #include +#include #include #include #include @@ -21,7 +22,7 @@ namespace boost { namespace fusion { template + typename Category = typename traits::category_of::type> struct iterator_adapter : iterator_facade { From 7a7b225fb15c4e5e28e87f06d6031c845712cabb Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Mon, 3 Nov 2014 12:43:25 +0900 Subject: [PATCH 5/9] Add boost_tuple_iterator_identity to compare iterator correctly. And add test for boost_tuple_iterator. --- .../boost_tuple/boost_tuple_iterator.hpp | 20 +++++++++++++++--- test/Jamfile | 1 + test/sequence/boost_tuple_iterator.cpp | 21 +++++++++++++++++++ 3 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 test/sequence/boost_tuple_iterator.cpp diff --git a/include/boost/fusion/adapted/boost_tuple/boost_tuple_iterator.hpp b/include/boost/fusion/adapted/boost_tuple/boost_tuple_iterator.hpp index 416880b4..40c5d79c 100644 --- a/include/boost/fusion/adapted/boost_tuple/boost_tuple_iterator.hpp +++ b/include/boost/fusion/adapted/boost_tuple/boost_tuple_iterator.hpp @@ -42,12 +42,18 @@ namespace boost { namespace fusion struct boost_tuple_is_empty const> : mpl::true_ {}; } + template + struct boost_tuple_iterator_identity; + template struct boost_tuple_iterator : iterator_facade, forward_traversal_tag> { typedef Cons cons_type; + typedef boost_tuple_iterator_identity< + typename add_const::type> identity; + BOOST_FUSION_GPU_ENABLED explicit boost_tuple_iterator(Cons& in_cons) : cons(in_cons) {} @@ -98,7 +104,7 @@ namespace boost { namespace fusion return type(iter.cons.get_tail()); } }; - + template struct distance; @@ -115,7 +121,7 @@ namespace boost { namespace fusion >::type >::type type; }; - + template struct distance { @@ -124,7 +130,7 @@ namespace boost { namespace fusion mpl::int_<0>, lazy_next_distance >::type type; - + BOOST_FUSION_GPU_ENABLED static type call(I1 const&, I2 const&) @@ -133,6 +139,11 @@ namespace boost { namespace fusion } }; + template + struct equal_to + : is_same + {}; + private: // silence MSVC warning C4512: assignment operator could not be generated boost_tuple_iterator& operator= (boost_tuple_iterator const&); @@ -144,6 +155,9 @@ namespace boost { namespace fusion { typedef Null cons_type; + typedef boost_tuple_iterator_identity< + typename add_const::type> identity; + template struct equal_to : mpl::or_< diff --git a/test/Jamfile b/test/Jamfile index 6e3ca32e..e74b7a95 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -60,6 +60,7 @@ project [ run sequence/as_set.cpp : : : : ] [ run sequence/as_vector.cpp : : : : ] [ run sequence/boost_tuple.cpp : : : : ] + [ run sequence/boost_tuple_iterator.cpp : : : : ] [ run sequence/cons.cpp : : : : ] [ run sequence/filter_view.cpp : : : : ] [ run sequence/hash.cpp : : : : ] diff --git a/test/sequence/boost_tuple_iterator.cpp b/test/sequence/boost_tuple_iterator.cpp new file mode 100644 index 00000000..3ab096b9 --- /dev/null +++ b/test/sequence/boost_tuple_iterator.cpp @@ -0,0 +1,21 @@ +/*============================================================================= + 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 + +#define FUSION_SEQUENCE boost::tuple +#define FUSION_TRAVERSAL_TAG forward_traversal_tag +#define FUSION_NO_PRIOR +#include "./iterator.hpp" + +int +main() +{ + test(); + return boost::report_errors(); +} + From a87a6650729932d3dbdee01af40a85d89f3946bc Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Fri, 7 Nov 2014 12:40:25 +0900 Subject: [PATCH 6/9] Fix description of find_if document. --- doc/algorithm.qbk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/algorithm.qbk b/doc/algorithm.qbk index a26637ce..8e35f6dc 100644 --- a/doc/algorithm.qbk +++ b/doc/algorithm.qbk @@ -574,10 +574,10 @@ Linear. At most `__result_of_size__::value` comparisons. [endsect] [section find_if] -Finds the first element within a sequence with a type for which a given __mpl_lambda_expression__ evaluates to -`boost::mpl::true_`. [heading Description] +Finds the first element within a sequence with a type for which a given __mpl_lambda_expression__ evaluates to +`boost::mpl::true_`. [heading Synopsis] template< From 834250a4c8da9b26df7e54c9f1e7c0fa44480ee9 Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Fri, 7 Nov 2014 13:20:43 +0900 Subject: [PATCH 7/9] Describe find(_if) return type clearly. --- doc/algorithm.qbk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/algorithm.qbk b/doc/algorithm.qbk index 8e35f6dc..6d8a9434 100644 --- a/doc/algorithm.qbk +++ b/doc/algorithm.qbk @@ -536,13 +536,13 @@ Finds the first element of a given type within a sequence. typename T, typename Sequence > - __unspecified__ find(Sequence const& seq); + typename __result_of_find__::type find(Sequence const& seq); template< typename T, typename Sequence > - __unspecified__ find(Sequence& seq); + typename __result_of_find__::type find(Sequence& seq); [table Parameters [[Parameter][Requirement][Description]] @@ -584,13 +584,13 @@ Finds the first element within a sequence with a type for which a given __mpl_la typename F, typename Sequence > - __unspecified__ find_if(Sequence const& seq); + typename __result_of_find_if__::type find_if(Sequence const& seq); template< typename F, typename Sequence > - __unspecified__ find_if(Sequence& seq); + typename __result_of_find_if__::type find_if(Sequence& seq); [table Parameters [[Parameter][Requirement][Description]] From bd5ce92e10d96c278a931a2f6cb57d7378f26ce7 Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Sat, 8 Nov 2014 02:32:06 +0900 Subject: [PATCH 8/9] Replace type_traits::ice_and with well documented mpl::and_. --- include/boost/fusion/algorithm/auxiliary/copy.hpp | 15 +++++---------- include/boost/fusion/algorithm/auxiliary/move.hpp | 15 +++++---------- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/include/boost/fusion/algorithm/auxiliary/copy.hpp b/include/boost/fusion/algorithm/auxiliary/copy.hpp index 7ac8e6f5..f8e16e92 100644 --- a/include/boost/fusion/algorithm/auxiliary/copy.hpp +++ b/include/boost/fusion/algorithm/auxiliary/copy.hpp @@ -16,7 +16,7 @@ #include #include #include -#include +#include #if defined (BOOST_MSVC) # pragma warning(push) @@ -62,15 +62,10 @@ namespace boost { namespace fusion template BOOST_FUSION_GPU_ENABLED - inline - typename - enable_if_c< - type_traits::ice_and< - traits::is_sequence::value - , traits::is_sequence::value - >::value, - void - >::type + inline typename enable_if, + traits::is_sequence + > >::type copy(Seq1 const& src, Seq2& dest) { BOOST_STATIC_ASSERT( diff --git a/include/boost/fusion/algorithm/auxiliary/move.hpp b/include/boost/fusion/algorithm/auxiliary/move.hpp index 688f54a9..81fe1d51 100644 --- a/include/boost/fusion/algorithm/auxiliary/move.hpp +++ b/include/boost/fusion/algorithm/auxiliary/move.hpp @@ -16,7 +16,7 @@ #include #include #include -#include +#include #if defined (BOOST_MSVC) # pragma warning(push) @@ -62,15 +62,10 @@ namespace boost { namespace fusion template BOOST_FUSION_GPU_ENABLED - inline - typename - enable_if_c< - type_traits::ice_and< - traits::is_sequence::value - , traits::is_sequence::value - >::value, - void - >::type + inline typename enable_if, + traits::is_sequence + > >::type move(Seq1&& src, Seq2& dest) { BOOST_STATIC_ASSERT( From ff56beaf55a567703393fd0d15b405a9f8a22f3d Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Sun, 9 Nov 2014 00:49:29 +0900 Subject: [PATCH 9/9] Remove use of `boost::blank`, close #8622 --- include/boost/fusion/sequence/intrinsic/begin.hpp | 4 ++-- include/boost/fusion/sequence/intrinsic/end.hpp | 4 ++-- test/functional/fused.cpp | 4 ++-- test/functional/fused_function_object.cpp | 4 ++-- test/functional/fused_procedure.cpp | 4 ++-- test/functional/make_fused.cpp | 4 ++-- test/functional/make_fused_function_object.cpp | 4 ++-- test/functional/make_fused_procedure.cpp | 4 ++-- test/functional/make_unfused.cpp | 14 ++++++++------ test/functional/unfused.cpp | 4 ++-- test/functional/unfused_typed.cpp | 6 ++---- 11 files changed, 28 insertions(+), 28 deletions(-) diff --git a/include/boost/fusion/sequence/intrinsic/begin.hpp b/include/boost/fusion/sequence/intrinsic/begin.hpp index 815d9813..79c14d74 100644 --- a/include/boost/fusion/sequence/intrinsic/begin.hpp +++ b/include/boost/fusion/sequence/intrinsic/begin.hpp @@ -8,8 +8,8 @@ #define FUSION_BEGIN_04052005_1132 #include -#include #include +#include #include #include #include @@ -36,7 +36,7 @@ namespace boost { namespace fusion : mpl::if_< traits::is_segmented , detail::segmented_begin - , blank + , mpl::empty_base >::type {}; }; diff --git a/include/boost/fusion/sequence/intrinsic/end.hpp b/include/boost/fusion/sequence/intrinsic/end.hpp index e60c62ea..b342468f 100644 --- a/include/boost/fusion/sequence/intrinsic/end.hpp +++ b/include/boost/fusion/sequence/intrinsic/end.hpp @@ -8,8 +8,8 @@ #define FUSION_END_04052005_1141 #include -#include #include +#include #include #include #include @@ -36,7 +36,7 @@ namespace boost { namespace fusion : mpl::if_< traits::is_segmented , detail::segmented_end - , blank + , mpl::empty_base >::type {}; }; diff --git a/test/functional/fused.cpp b/test/functional/fused.cpp index e2c89395..b2ce8dde 100644 --- a/test/functional/fused.cpp +++ b/test/functional/fused.cpp @@ -10,18 +10,18 @@ #include #include -#include #include #include #include #include +#include namespace fusion = boost::fusion; using boost::noncopyable; -template +template struct test_func : Base { diff --git a/test/functional/fused_function_object.cpp b/test/functional/fused_function_object.cpp index c8d4c590..399745a0 100644 --- a/test/functional/fused_function_object.cpp +++ b/test/functional/fused_function_object.cpp @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include @@ -18,7 +18,7 @@ namespace fusion = boost::fusion; using boost::noncopyable; -template +template struct test_func : Base { diff --git a/test/functional/fused_procedure.cpp b/test/functional/fused_procedure.cpp index 57443c20..1ed0ddf7 100644 --- a/test/functional/fused_procedure.cpp +++ b/test/functional/fused_procedure.cpp @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include @@ -26,7 +26,7 @@ int effect; BOOST_TEST(effect == e); \ } -template +template struct test_func : Base { diff --git a/test/functional/make_fused.cpp b/test/functional/make_fused.cpp index a207359c..ceb82063 100644 --- a/test/functional/make_fused.cpp +++ b/test/functional/make_fused.cpp @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include @@ -20,7 +20,7 @@ using boost::noncopyable; using boost::cref; using boost::ref; -template +template struct test_func : Base { diff --git a/test/functional/make_fused_function_object.cpp b/test/functional/make_fused_function_object.cpp index 87ee8e23..79ea517b 100644 --- a/test/functional/make_fused_function_object.cpp +++ b/test/functional/make_fused_function_object.cpp @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include @@ -20,7 +20,7 @@ using boost::noncopyable; using boost::cref; using boost::ref; -template +template struct test_func : Base { diff --git a/test/functional/make_fused_procedure.cpp b/test/functional/make_fused_procedure.cpp index ce7e267c..2fa2762c 100644 --- a/test/functional/make_fused_procedure.cpp +++ b/test/functional/make_fused_procedure.cpp @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include @@ -28,7 +28,7 @@ int effect; BOOST_TEST(effect == e); \ } -template +template struct test_func : Base { diff --git a/test/functional/make_unfused.cpp b/test/functional/make_unfused.cpp index 1e286918..73be142b 100644 --- a/test/functional/make_unfused.cpp +++ b/test/functional/make_unfused.cpp @@ -10,14 +10,15 @@ #include #include -#include +#include #include #include +#include #include -#include #include +#include #include #include @@ -33,17 +34,18 @@ typedef mpl::true_ no_nullary_call; using boost::ref; using boost::cref; -template +template struct test_func : Base { template struct result; - template + template struct result< Self(Seq &) > - : mpl::if_< mpl::and_< boost::fusion::result_of::empty, RemoveNullary >, - boost::blank, mpl::identity >::type + : boost::enable_if< + mpl::not_, RemoveNullary> >, + long> { }; template diff --git a/test/functional/unfused.cpp b/test/functional/unfused.cpp index bde9b95b..1e30eabd 100644 --- a/test/functional/unfused.cpp +++ b/test/functional/unfused.cpp @@ -10,8 +10,8 @@ #include #include -#include +#include #include #include @@ -24,7 +24,7 @@ namespace mpl = boost::mpl; using boost::noncopyable; -template +template struct test_func : Base { diff --git a/test/functional/unfused_typed.cpp b/test/functional/unfused_typed.cpp index 93c35b6d..eaa03425 100644 --- a/test/functional/unfused_typed.cpp +++ b/test/functional/unfused_typed.cpp @@ -9,11 +9,9 @@ #include #include -#include #include -#include - +#include #include #include @@ -31,7 +29,7 @@ typedef fusion::vector<> types0; typedef fusion::vector types1; typedef fusion::vector types3; -template +template struct test_func : Base {