From 9036c72a61d6c1fda2c446e04c549fde528d92a8 Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Sat, 7 Jul 2018 07:08:17 +0900 Subject: [PATCH 1/4] find_if: Removed unnecessary mpl::lambda mpl::apply can treat placeholder expression --- include/boost/fusion/algorithm/query/detail/find_if.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/fusion/algorithm/query/detail/find_if.hpp b/include/boost/fusion/algorithm/query/detail/find_if.hpp index b200794a..56c5296c 100644 --- a/include/boost/fusion/algorithm/query/detail/find_if.hpp +++ b/include/boost/fusion/algorithm/query/detail/find_if.hpp @@ -2,6 +2,7 @@ Copyright (c) 2001-2011 Joel de Guzman Copyright (c) 2007 Dan Marsden Copyright (c) 2009 Christopher Schmidt + Copyright (c) 2018 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) @@ -13,7 +14,6 @@ #include #include #include -#include #include #include #include @@ -178,7 +178,7 @@ namespace detail choose_find_if< First , Last - , typename mpl::lambda::type + , Pred , is_base_of::type>::value >::type type; From 47ff2e6cb5c8479cf2b7875867590f0af1f99324 Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Sat, 7 Jul 2018 07:18:56 +0900 Subject: [PATCH 2/4] find_if: Improved tag usage The traversal tag is a bit complex than before. --- .../fusion/algorithm/query/detail/find_if.hpp | 25 ++++++------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/include/boost/fusion/algorithm/query/detail/find_if.hpp b/include/boost/fusion/algorithm/query/detail/find_if.hpp index 56c5296c..06a7af79 100644 --- a/include/boost/fusion/algorithm/query/detail/find_if.hpp +++ b/include/boost/fusion/algorithm/query/detail/find_if.hpp @@ -22,10 +22,9 @@ #include #include #include +#include -namespace boost { namespace fusion { - struct random_access_traversal_tag; -namespace detail +namespace boost { namespace fusion { namespace detail { template struct apply_filter @@ -179,7 +178,7 @@ namespace detail First , Last , Pred - , is_base_of::type>::value + , traits::is_random_access::value >::type type; @@ -208,31 +207,23 @@ namespace detail return recursive_call(iter, found()); } - template + template BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED - static type - choose_call(Iterator const& iter, Tag) + static typename boost::disable_if, type>::type + iter_call(Iterator const& iter) { return recursive_call(iter); } template BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED - static type - choose_call(Iterator const& iter, random_access_traversal_tag) + static typename boost::enable_if, type>::type + iter_call(Iterator const& iter) { typedef typename result_of::distance::type N; return fusion::advance(iter); } - template - BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED - static type - iter_call(Iterator const& iter) - { - return choose_call(iter, typename traits::category_of::type()); - } - template BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type From cc3fbc4f5dac44baa093af18c31c0930545d482d Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Sat, 7 Jul 2018 07:47:33 +0900 Subject: [PATCH 3/4] Removed unused headers --- include/boost/fusion/algorithm/transformation/remove_if.hpp | 4 ++-- .../boost/fusion/view/filter_view/filter_view_iterator.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/boost/fusion/algorithm/transformation/remove_if.hpp b/include/boost/fusion/algorithm/transformation/remove_if.hpp index 5497e3a3..3f8ebbcd 100644 --- a/include/boost/fusion/algorithm/transformation/remove_if.hpp +++ b/include/boost/fusion/algorithm/transformation/remove_if.hpp @@ -1,7 +1,8 @@ /*============================================================================= Copyright (c) 2001-2011 Joel de Guzman + Copyright (c) 2018 Kohei Takahashi - Distributed under the Boost Software License, Version 1.0. (See accompanying + Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ #if !defined(FUSION_REMOVE_IF_07162005_0818) @@ -10,7 +11,6 @@ #include #include #include -#include namespace boost { namespace fusion { diff --git a/include/boost/fusion/view/filter_view/filter_view_iterator.hpp b/include/boost/fusion/view/filter_view/filter_view_iterator.hpp index f1b9f54d..8d77e12e 100644 --- a/include/boost/fusion/view/filter_view/filter_view_iterator.hpp +++ b/include/boost/fusion/view/filter_view/filter_view_iterator.hpp @@ -1,5 +1,6 @@ /*============================================================================= Copyright (c) 2001-2011 Joel de Guzman + Copyright (c) 2018 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) @@ -9,7 +10,6 @@ #include #include -#include #include #include #include From 48f8af3e73dc35d19a3d54ff70520eff64dabd09 Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Sat, 7 Jul 2018 08:17:26 +0900 Subject: [PATCH 4/4] filter_view: Removed redundant filter operation Iterator constructor always filters and determines right position. --- .../view/filter_view/detail/next_impl.hpp | 26 ++++--------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/include/boost/fusion/view/filter_view/detail/next_impl.hpp b/include/boost/fusion/view/filter_view/detail/next_impl.hpp index 4f174557..bd1404b9 100644 --- a/include/boost/fusion/view/filter_view/detail/next_impl.hpp +++ b/include/boost/fusion/view/filter_view/detail/next_impl.hpp @@ -1,5 +1,6 @@ /*============================================================================= Copyright (c) 2001-2011 Joel de Guzman + Copyright (c) 2018 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) @@ -8,14 +9,10 @@ #define FUSION_NEXT_IMPL_06052005_0900 #include -#include -#include +#include +#include #include #include -#include -#include -#include -#include namespace boost { namespace fusion { @@ -48,26 +45,13 @@ namespace boost { namespace fusion >::type next_type; - typedef typename - detail::static_find_if< - next_type - , last_type - , mpl::bind1< - typename mpl::lambda::type - , mpl::bind1,mpl::_1> - > - > - filter; - - typedef filter_iterator< - category, typename filter::type, last_type, pred_type> - type; + typedef filter_iterator type; BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Iterator const& i) { - return type(filter::iter_call(i.first)); + return type(fusion::next(i.first)); } }; };