Fixes for MSVC workarounds from Freundlich: http://codepad.org/wRelwDJt

[SVN r75595]
This commit is contained in:
Joel de Guzman
2011-11-21 14:43:19 +00:00
parent 0a520f6021
commit 48e4118768
6 changed files with 44 additions and 25 deletions

View File

@ -36,7 +36,7 @@ namespace boost { namespace fusion
: vec(rhs.vec) {}
template <typename Sequence>
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_<I::value>());
}
private:
BOOST_FUSION_VECTOR_CTOR_HELPER()
vector_n vec;
};
}}

View File

@ -36,7 +36,7 @@ namespace boost { namespace fusion
: vec(rhs.vec) {}
template <typename Sequence>
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_<I::value>());
}
private:
BOOST_FUSION_VECTOR_CTOR_HELPER()
vector_n vec;
};
}}

View File

@ -36,7 +36,7 @@ namespace boost { namespace fusion
: vec(rhs.vec) {}
template <typename Sequence>
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_<I::value>());
}
private:
BOOST_FUSION_VECTOR_CTOR_HELPER()
vector_n vec;
};
}}

View File

@ -36,7 +36,7 @@ namespace boost { namespace fusion
: vec(rhs.vec) {}
template <typename Sequence>
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_<I::value>());
}
private:
BOOST_FUSION_VECTOR_CTOR_HELPER()
vector_n vec;
};
}}

View File

@ -36,7 +36,7 @@ namespace boost { namespace fusion
: vec(rhs.vec) {}
template <typename Sequence>
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_<I::value>());
}
private:
BOOST_FUSION_VECTOR_CTOR_HELPER()
vector_n vec;
};
}}

View File

@ -17,6 +17,38 @@
#include <boost/type_traits/is_base_of.hpp>
#include <boost/detail/workaround.hpp>
#if !defined(__WAVE__)
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1600)
#define BOOST_FUSION_VECTOR_COPY_INIT() \
ctor_helper(rhs, is_base_of<vector, Sequence>()) \
#define BOOST_FUSION_VECTOR_CTOR_HELPER() \
static vector_n const& \
ctor_helper(vector const& rhs, mpl::true_) \
{ \
return rhs.vec; \
} \
\
template <typename T> \
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 <boost/fusion/container/vector/detail/preprocessed/vector.hpp>
#else
@ -76,11 +108,7 @@ namespace boost { namespace fusion
template <typename Sequence>
vector(Sequence const& rhs)
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1600)
: vec(ctor_helper(rhs, is_base_of<vector, Sequence>())) {}
#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 <typename T>
static T const&
ctor_helper(T const& rhs, mpl::false_)
{
return rhs;
}
#endif
BOOST_FUSION_VECTOR_CTOR_HELPER()
vector_n vec;
};
}}