From fc434bd837ed28f84297955eecced784d7a65f00 Mon Sep 17 00:00:00 2001 From: Joel de Guzman Date: Wed, 11 Oct 2006 12:10:06 +0000 Subject: [PATCH] workaround for vc++ mistakenly calling constructor from T instead of copy constructor when T is derived from vector. [SVN r35553] --- .../sequence/container/vector/vector.hpp | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/include/boost/fusion/sequence/container/vector/vector.hpp b/include/boost/fusion/sequence/container/vector/vector.hpp index c81fc738..e4da4e70 100644 --- a/include/boost/fusion/sequence/container/vector/vector.hpp +++ b/include/boost/fusion/sequence/container/vector/vector.hpp @@ -16,6 +16,8 @@ #include #include #include +#include +#include namespace boost { namespace fusion { @@ -51,9 +53,16 @@ namespace boost { namespace fusion vector(vector const& rhs) : vec(rhs.vec) {} + vector(vector const& rhs) + : vec(rhs.vec) {} + template explicit vector(T const& rhs) +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1400) + : vec(ctor_helper(rhs, is_base_of())) {} +#else : vec(rhs) {} +#endif // Expand a couple of forwarding constructors for arguments // of type (T0), (T0, T1), (T0, T1, T2) etc. Example: @@ -117,10 +126,25 @@ namespace boost { namespace fusion >::type at_impl(I index) const { - return vec.at_impl(mpl::int_()); + return vec.at_impl(mpl::int_()); } private: + +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1400) + 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 vector_n vec; };