From 326104a9b754ddfee00ff36f7daad71d24762f51 Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Sun, 18 Jan 2015 02:23:40 +0900 Subject: [PATCH 1/3] Fix unexpected overload resolution on MSVC. --- include/boost/fusion/container/deque/detail/cpp03/deque.hpp | 5 ++++- .../boost/fusion/container/deque/detail/keyed_element.hpp | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/boost/fusion/container/deque/detail/cpp03/deque.hpp b/include/boost/fusion/container/deque/detail/cpp03/deque.hpp index 1b92ceaf..7f630bbb 100644 --- a/include/boost/fusion/container/deque/detail/cpp03/deque.hpp +++ b/include/boost/fusion/container/deque/detail/cpp03/deque.hpp @@ -141,7 +141,10 @@ FUSION_HASH if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) {} template BOOST_FUSION_GPU_ENABLED - deque(deque&& seq) + deque(deque&& seq + , typename disable_if< + is_convertible, T0> + >::type* /*dummy*/ = 0) : base(std::forward>(seq)) {} template diff --git a/include/boost/fusion/container/deque/detail/keyed_element.hpp b/include/boost/fusion/container/deque/detail/keyed_element.hpp index 37aba9fd..0137444a 100644 --- a/include/boost/fusion/container/deque/detail/keyed_element.hpp +++ b/include/boost/fusion/container/deque/detail/keyed_element.hpp @@ -66,7 +66,8 @@ namespace boost { namespace fusion { namespace detail template BOOST_FUSION_GPU_ENABLED - keyed_element(keyed_element const& rhs) + keyed_element(keyed_element const& rhs + , typename enable_if >::type* = 0) : Rest(rhs.get_base()), value_(rhs.value_) {} From 995202044c7a1c23f101469aa3683dc8a3a5b981 Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Sun, 18 Jan 2015 23:01:48 +0900 Subject: [PATCH 2/3] Basic move support for c++03 map --- .../fusion/container/map/detail/cpp03/map.hpp | 45 +++++++++++++++++++ .../map/detail/cpp03/map_forward_ctor.hpp | 30 +++++++++++-- 2 files changed, 72 insertions(+), 3 deletions(-) diff --git a/include/boost/fusion/container/map/detail/cpp03/map.hpp b/include/boost/fusion/container/map/detail/cpp03/map.hpp index 8673895e..77227aae 100644 --- a/include/boost/fusion/container/map/detail/cpp03/map.hpp +++ b/include/boost/fusion/container/map/detail/cpp03/map.hpp @@ -24,6 +24,15 @@ #include #include #include +#include +#include +#include +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && \ + defined(BOOST_MSVC) && (BOOST_MSVC == 1700) +// see map_forward_ctor.hpp +#include +#include +#endif #if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES) #include @@ -45,6 +54,8 @@ #pragma wave option(preserve: 1) #endif +#define FUSION_HASH # + namespace boost { namespace fusion { struct void_; @@ -69,6 +80,10 @@ namespace boost { namespace fusion map() : data() {} + BOOST_FUSION_GPU_ENABLED + map(map const& rhs) + : data(rhs.data) {} + template BOOST_FUSION_GPU_ENABLED map(Sequence const& rhs) @@ -91,6 +106,34 @@ namespace boost { namespace fusion return *this; } +#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES) +FUSION_HASH if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) +#endif +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \ + (defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)) + BOOST_FUSION_GPU_ENABLED + map(map&& rhs) + : data(std::move(rhs.data)) {} + + template + BOOST_FUSION_GPU_ENABLED + map& operator=(T&& rhs) + { + data = BOOST_FUSION_FWD_ELEM(T, rhs); + return *this; + } + + BOOST_FUSION_GPU_ENABLED + map& operator=(map&& rhs) + { + data = std::move(rhs.data); + return *this; + } +#endif +#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES) +FUSION_HASH endif +#endif + BOOST_FUSION_GPU_ENABLED storage_type& get_data() { return data; } BOOST_FUSION_GPU_ENABLED @@ -102,6 +145,8 @@ namespace boost { namespace fusion }; }} +#undef FUSION_HASH + #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES) #pragma wave option(output: null) #endif diff --git a/include/boost/fusion/container/map/detail/cpp03/map_forward_ctor.hpp b/include/boost/fusion/container/map/detail/cpp03/map_forward_ctor.hpp index 3938f9a4..f69e5ee6 100644 --- a/include/boost/fusion/container/map/detail/cpp03/map_forward_ctor.hpp +++ b/include/boost/fusion/container/map/detail/cpp03/map_forward_ctor.hpp @@ -8,15 +8,14 @@ #if !defined(FUSION_MAP_FORWARD_CTOR_07222005_0106) #define FUSION_MAP_FORWARD_CTOR_07222005_0106 -#include -#include -#include +#define FUSION_FORWARD_CTOR_FORWARD(z, n, _) BOOST_FUSION_FWD_ELEM(U##n, _##n) #define BOOST_PP_FILENAME_1 \ #define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_MAP_SIZE) #include BOOST_PP_ITERATE() +#undef FUSION_FORWARD_CTOR_FORWARD #endif #else // defined(BOOST_PP_IS_ITERATING) /////////////////////////////////////////////////////////////////////////////// @@ -34,6 +33,31 @@ map(BOOST_PP_ENUM_BINARY_PARAMS(N, typename detail::call_param::type arg)) : data(BOOST_PP_ENUM_PARAMS(N, arg)) {} +#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES) +FUSION_HASH if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) +#endif +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \ + (defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)) + template + BOOST_FUSION_GPU_ENABLED +#if N == 1 + explicit +#endif + map(BOOST_PP_ENUM_BINARY_PARAMS(N, U, && arg) +#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES) && \ + N == 1 + // workaround for MSVC 10 +FUSION_HASH if defined(BOOST_MSVC) && (BOOST_MSVC == 1700) + , typename enable_if >::type* = 0 +FUSION_HASH endif +#endif + ) + : data(BOOST_PP_ENUM(N, FUSION_FORWARD_CTOR_FORWARD, arg)) {} +#endif +#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES) +FUSION_HASH endif +#endif + #undef N #endif // defined(BOOST_PP_IS_ITERATING) From b60219eb8adbbbf555b7a192208d5c3a67abbfd8 Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Mon, 2 Feb 2015 04:08:13 +0900 Subject: [PATCH 3/3] Fix testcase for MSVC 10.0. MSVC 10.0/11.0 have but don't compile variadic templates. --- test/sequence/size.cpp | 6 ++++-- test/sequence/std_tuple_iterator.cpp | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/test/sequence/size.cpp b/test/sequence/size.cpp index f8254dad..8c4c5a55 100644 --- a/test/sequence/size.cpp +++ b/test/sequence/size.cpp @@ -19,7 +19,8 @@ #include #include #include -#if !defined(BOOST_NO_CXX11_HDR_TUPLE) +#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && \ + !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #include #include #endif @@ -89,7 +90,8 @@ void test() check >(); } -#if !defined(BOOST_NO_CXX11_HDR_TUPLE) +#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && \ + !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) { check >(); check >(); diff --git a/test/sequence/std_tuple_iterator.cpp b/test/sequence/std_tuple_iterator.cpp index 202fb7a5..e33db386 100644 --- a/test/sequence/std_tuple_iterator.cpp +++ b/test/sequence/std_tuple_iterator.cpp @@ -8,7 +8,8 @@ // The std_tuple_iterator adaptor only supports implementations // using variadic templates -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && \ + !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #include