From c750552a0255676a0bba40261179e3c3ed3a90cd Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Tue, 6 Oct 2015 11:28:16 +0900 Subject: [PATCH 1/4] Tweak coding style. --- include/boost/fusion/container/vector/vector.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/boost/fusion/container/vector/vector.hpp b/include/boost/fusion/container/vector/vector.hpp index ab1c1f04..9c5032f9 100644 --- a/include/boost/fusion/container/vector/vector.hpp +++ b/include/boost/fusion/container/vector/vector.hpp @@ -66,12 +66,12 @@ namespace boost { namespace fusion template BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline each_elem - dispatch( T const&... ) BOOST_NOEXCEPT { return each_elem(); } + dispatch(T const&...) BOOST_NOEXCEPT { return each_elem(); } template BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline copy_or_move - dispatch( This const& ) BOOST_NOEXCEPT { return copy_or_move(); } + dispatch(This const&) BOOST_NOEXCEPT { return copy_or_move(); } template BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED @@ -82,7 +82,7 @@ namespace boost { namespace fusion , make_indices_from_seq >::type > - dispatch( Sequence const& ) BOOST_NOEXCEPT + dispatch(Sequence const&) BOOST_NOEXCEPT { return from_sequence::type>(); } From ca0d92e68df0a0fe109db37043847fecd7044246 Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Tue, 6 Oct 2015 21:29:02 +0900 Subject: [PATCH 2/4] R-value references are now container-wide requirements. --- .../fusion/container/generation/make_set.hpp | 15 +++++++++++--- include/boost/fusion/container/set/set.hpp | 20 ------------------- 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/include/boost/fusion/container/generation/make_set.hpp b/include/boost/fusion/container/generation/make_set.hpp index 7f98532b..cd8519e5 100644 --- a/include/boost/fusion/container/generation/make_set.hpp +++ b/include/boost/fusion/container/generation/make_set.hpp @@ -19,6 +19,9 @@ /////////////////////////////////////////////////////////////////////////////// #include +#include +#include +#include namespace boost { namespace fusion { @@ -27,16 +30,22 @@ namespace boost { namespace fusion template struct make_set { - typedef set::type...> type; + typedef set< + typename detail::as_fusion_element< + typename remove_const< + typename remove_reference::type + >::type + >::type... + > type; }; } template BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::make_set::type - make_set(T const&... arg) + make_set(T&&... arg) { - return typename result_of::make_set::type(arg...); + return typename result_of::make_set::type(std::forward(arg)...); } }} diff --git a/include/boost/fusion/container/set/set.hpp b/include/boost/fusion/container/set/set.hpp index 0d93290b..8d5cc13b 100644 --- a/include/boost/fusion/container/set/set.hpp +++ b/include/boost/fusion/container/set/set.hpp @@ -95,41 +95,22 @@ namespace boost { namespace fusion set() : data() {} - template - BOOST_FUSION_GPU_ENABLED - set(Sequence const& rhs) - : data(rhs) {} - -#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) template BOOST_FUSION_GPU_ENABLED set(Sequence&& rhs) : data(std::forward(rhs)) {} -#endif BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED explicit set(typename detail::call_param::type ...args) : data(args...) {} -#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) template BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED explicit set(U&& ...args) : data(std::forward(args)...) {} -#endif - template - BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED - set& - operator=(U const& rhs) - { - data = rhs; - return *this; - } - -#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) template BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED set& @@ -138,7 +119,6 @@ namespace boost { namespace fusion data = std::forward(rhs); return *this; } -#endif BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED storage_type& get_data() { return data; } From 5114d9419e50d54fb2b8cbc6ba40e031b12fede1 Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Wed, 7 Oct 2015 17:40:55 +0900 Subject: [PATCH 3/4] Drop unnecessary ctor. --- include/boost/fusion/container/set/set.hpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/include/boost/fusion/container/set/set.hpp b/include/boost/fusion/container/set/set.hpp index 8d5cc13b..df87c495 100644 --- a/include/boost/fusion/container/set/set.hpp +++ b/include/boost/fusion/container/set/set.hpp @@ -100,13 +100,8 @@ namespace boost { namespace fusion set(Sequence&& rhs) : data(std::forward(rhs)) {} - BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED - explicit - set(typename detail::call_param::type ...args) - : data(args...) {} - template - BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED explicit set(U&& ...args) : data(std::forward(args)...) {} From ce4ccb929c04dab25ba941c5ba010480d677cbbd Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Thu, 8 Oct 2015 22:23:10 +0900 Subject: [PATCH 4/4] Check the argument being fusion sequence or not. --- include/boost/fusion/container/set/set.hpp | 12 ++++++-- .../fusion/support/detail/is_same_size.hpp | 29 +++++++++++++++++++ 2 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 include/boost/fusion/support/detail/is_same_size.hpp diff --git a/include/boost/fusion/container/set/set.hpp b/include/boost/fusion/container/set/set.hpp index df87c495..12fd8115 100644 --- a/include/boost/fusion/container/set/set.hpp +++ b/include/boost/fusion/container/set/set.hpp @@ -23,6 +23,8 @@ #include #include #include +#include +#include #include #include #include @@ -31,8 +33,8 @@ #include #include #include -#include #include +#include namespace boost { namespace fusion { @@ -57,7 +59,9 @@ namespace boost { namespace fusion template BOOST_FUSION_GPU_ENABLED - set(Sequence const& rhs) + set(Sequence const& rhs, + typename enable_if >::type* = 0, + typename enable_if >::type* = 0) : data(rhs) {} template @@ -97,7 +101,9 @@ namespace boost { namespace fusion template BOOST_FUSION_GPU_ENABLED - set(Sequence&& rhs) + set(Sequence&& rhs, + typename enable_if >::type* = 0, + typename enable_if >::type* = 0) : data(std::forward(rhs)) {} template diff --git a/include/boost/fusion/support/detail/is_same_size.hpp b/include/boost/fusion/support/detail/is_same_size.hpp new file mode 100644 index 00000000..b1bf7cde --- /dev/null +++ b/include/boost/fusion/support/detail/is_same_size.hpp @@ -0,0 +1,29 @@ +/*============================================================================= + Copyright (c) 2014-2015 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 FUSION_IS_SAME_SIZE_10082015_1156 +#define FUSION_IS_SAME_SIZE_10082015_1156 + +#include +#include +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + template + struct is_same_size : mpl::false_ {}; + + template + struct is_same_size >::type, + typename enable_if >::type> + : mpl::equal_to, result_of::size > + {}; +}}} + +#endif