diff --git a/doc/algorithm.qbk b/doc/algorithm.qbk index 33355b62..9ad943ee 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]] @@ -574,23 +574,23 @@ 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< 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]] 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/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( 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 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/iterator/iterator_adapter.hpp b/include/boost/fusion/iterator/iterator_adapter.hpp index 28ea0b6c..7e860c77 100644 --- a/include/boost/fusion/iterator/iterator_adapter.hpp +++ b/include/boost/fusion/iterator/iterator_adapter.hpp @@ -8,14 +8,21 @@ #define FUSION_ITERATOR_ADAPTER_08112011_0942 #include -#include +#include +#include +#include +#include +#include #include +#include +#include +#include #include namespace boost { namespace fusion { template + typename Category = typename traits::category_of::type> struct iterator_adapter : iterator_facade { 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 { 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/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); } }; 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/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/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 { diff --git a/include/boost/fusion/include/adapt_assoc_class.hpp b/test/sequence/boost_tuple_iterator.cpp similarity index 52% rename from include/boost/fusion/include/adapt_assoc_class.hpp rename to test/sequence/boost_tuple_iterator.cpp index 83d6c4da..3ab096b9 100644 --- a/include/boost/fusion/include/adapt_assoc_class.hpp +++ b/test/sequence/boost_tuple_iterator.cpp @@ -1,14 +1,21 @@ /*============================================================================= - Copyright (c) 2010 Christopher Schmidt + 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) ==============================================================================*/ -#ifndef BOOST_FUSION_INCLUDE_ADAPT_ASSOC_CLASS_HPP -#define BOOST_FUSION_INCLUDE_ADAPT_ASSOC_CLASS_HPP +#include -#include -#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(); +} -#endif