From 48e4118768caba348954eb8ba014f452c44d5624 Mon Sep 17 00:00:00 2001 From: Joel de Guzman Date: Mon, 21 Nov 2011 14:43:19 +0000 Subject: [PATCH] Fixes for MSVC workarounds from Freundlich: http://codepad.org/wRelwDJt [SVN r75595] --- .../vector/detail/preprocessed/vvector10.hpp | 3 +- .../vector/detail/preprocessed/vvector20.hpp | 3 +- .../vector/detail/preprocessed/vvector30.hpp | 3 +- .../vector/detail/preprocessed/vvector40.hpp | 3 +- .../vector/detail/preprocessed/vvector50.hpp | 3 +- .../boost/fusion/container/vector/vector.hpp | 54 ++++++++++++------- 6 files changed, 44 insertions(+), 25 deletions(-) diff --git a/include/boost/fusion/container/vector/detail/preprocessed/vvector10.hpp b/include/boost/fusion/container/vector/detail/preprocessed/vvector10.hpp index a566278a..8e6f1f68 100644 --- a/include/boost/fusion/container/vector/detail/preprocessed/vvector10.hpp +++ b/include/boost/fusion/container/vector/detail/preprocessed/vvector10.hpp @@ -36,7 +36,7 @@ namespace boost { namespace fusion : vec(rhs.vec) {} template vector(Sequence const& rhs) - : vec(rhs) {} + : vec(BOOST_FUSION_VECTOR_COPY_INIT()) {} @@ -116,6 +116,7 @@ namespace boost { namespace fusion return vec.at_impl(mpl::int_()); } private: + BOOST_FUSION_VECTOR_CTOR_HELPER() vector_n vec; }; }} diff --git a/include/boost/fusion/container/vector/detail/preprocessed/vvector20.hpp b/include/boost/fusion/container/vector/detail/preprocessed/vvector20.hpp index 378ea978..bc04fefe 100644 --- a/include/boost/fusion/container/vector/detail/preprocessed/vvector20.hpp +++ b/include/boost/fusion/container/vector/detail/preprocessed/vvector20.hpp @@ -36,7 +36,7 @@ namespace boost { namespace fusion : vec(rhs.vec) {} template vector(Sequence const& rhs) - : vec(rhs) {} + : vec(BOOST_FUSION_VECTOR_COPY_INIT()) {} @@ -136,6 +136,7 @@ namespace boost { namespace fusion return vec.at_impl(mpl::int_()); } private: + BOOST_FUSION_VECTOR_CTOR_HELPER() vector_n vec; }; }} diff --git a/include/boost/fusion/container/vector/detail/preprocessed/vvector30.hpp b/include/boost/fusion/container/vector/detail/preprocessed/vvector30.hpp index f49d3ef2..0841920a 100644 --- a/include/boost/fusion/container/vector/detail/preprocessed/vvector30.hpp +++ b/include/boost/fusion/container/vector/detail/preprocessed/vvector30.hpp @@ -36,7 +36,7 @@ namespace boost { namespace fusion : vec(rhs.vec) {} template vector(Sequence const& rhs) - : vec(rhs) {} + : vec(BOOST_FUSION_VECTOR_COPY_INIT()) {} @@ -156,6 +156,7 @@ namespace boost { namespace fusion return vec.at_impl(mpl::int_()); } private: + BOOST_FUSION_VECTOR_CTOR_HELPER() vector_n vec; }; }} diff --git a/include/boost/fusion/container/vector/detail/preprocessed/vvector40.hpp b/include/boost/fusion/container/vector/detail/preprocessed/vvector40.hpp index c683cba6..11d9cc7d 100644 --- a/include/boost/fusion/container/vector/detail/preprocessed/vvector40.hpp +++ b/include/boost/fusion/container/vector/detail/preprocessed/vvector40.hpp @@ -36,7 +36,7 @@ namespace boost { namespace fusion : vec(rhs.vec) {} template vector(Sequence const& rhs) - : vec(rhs) {} + : vec(BOOST_FUSION_VECTOR_COPY_INIT()) {} @@ -176,6 +176,7 @@ namespace boost { namespace fusion return vec.at_impl(mpl::int_()); } private: + BOOST_FUSION_VECTOR_CTOR_HELPER() vector_n vec; }; }} diff --git a/include/boost/fusion/container/vector/detail/preprocessed/vvector50.hpp b/include/boost/fusion/container/vector/detail/preprocessed/vvector50.hpp index 316f9d27..1ac6c6f4 100644 --- a/include/boost/fusion/container/vector/detail/preprocessed/vvector50.hpp +++ b/include/boost/fusion/container/vector/detail/preprocessed/vvector50.hpp @@ -36,7 +36,7 @@ namespace boost { namespace fusion : vec(rhs.vec) {} template vector(Sequence const& rhs) - : vec(rhs) {} + : vec(BOOST_FUSION_VECTOR_COPY_INIT()) {} @@ -196,6 +196,7 @@ namespace boost { namespace fusion return vec.at_impl(mpl::int_()); } private: + BOOST_FUSION_VECTOR_CTOR_HELPER() vector_n vec; }; }} diff --git a/include/boost/fusion/container/vector/vector.hpp b/include/boost/fusion/container/vector/vector.hpp index 5bb0b6ab..6563bc93 100644 --- a/include/boost/fusion/container/vector/vector.hpp +++ b/include/boost/fusion/container/vector/vector.hpp @@ -17,6 +17,38 @@ #include #include +#if !defined(__WAVE__) + +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1600) + +#define BOOST_FUSION_VECTOR_COPY_INIT() \ + ctor_helper(rhs, is_base_of()) \ + +#define BOOST_FUSION_VECTOR_CTOR_HELPER() \ + static vector_n const& \ + ctor_helper(vector const& rhs, mpl::true_) \ + { \ + return rhs.vec; \ + } \ + \ + template \ + static T const& \ + ctor_helper(T const& rhs, mpl::false_) \ + { \ + return rhs; \ + } + +#else + +#define BOOST_FUSION_VECTOR_COPY_INIT() \ + rhs \ + +#define BOOST_FUSION_VECTOR_CTOR_HELPER() + +#endif + +#endif // !defined(__WAVE__) + #if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES) #include #else @@ -76,11 +108,7 @@ namespace boost { namespace fusion template vector(Sequence const& rhs) -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1600) - : vec(ctor_helper(rhs, is_base_of())) {} -#else - : vec(rhs) {} -#endif + : vec(BOOST_FUSION_VECTOR_COPY_INIT()) {} // Expand a couple of forwarding constructors for arguments // of type (T0), (T0, T1), (T0, T1, T2) etc. Example: @@ -149,21 +177,7 @@ namespace boost { namespace fusion private: -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1600) - static vector_n const& - ctor_helper(vector const& rhs, mpl::true_) - { - return rhs.vec; - } - - template - static T const& - ctor_helper(T const& rhs, mpl::false_) - { - return rhs; - } -#endif - + BOOST_FUSION_VECTOR_CTOR_HELPER() vector_n vec; }; }}