forked from boostorg/fusion
Make C++11 fusion::vector more consistent with C++03 fusion::vector
- Construct from elements is enabled iff each argument is_convertible to corresponding element. - Construct from sequence is enabled iff the single argument is a fusion sequence. - C++11 vector and tuple also disable construct from sequence that are shorter than the destination. C++03 gives incorrect is_convertible responses in this situation and fails to compile if that constructor is used; C++11 can have instantation errors in and_<is_convertible<U, T>...> without the additional check. - C++11 tuple and vector support truncation conversion and assignment like all other sequences.
This commit is contained in:
@ -42,12 +42,22 @@ namespace boost { namespace fusion
|
||||
tuple()
|
||||
: base_type() {}
|
||||
|
||||
template <typename ...U>
|
||||
template <
|
||||
typename ...U
|
||||
, typename = typename boost::enable_if_c<
|
||||
sizeof...(U) >= sizeof...(T)
|
||||
>::type
|
||||
>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
tuple(tuple<U...> const& other)
|
||||
: base_type(other) {}
|
||||
|
||||
template <typename ...U>
|
||||
template <
|
||||
typename ...U
|
||||
, typename = typename boost::enable_if_c<
|
||||
sizeof...(U) >= sizeof...(T)
|
||||
>::type
|
||||
>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
tuple(tuple<U...>&& other)
|
||||
: base_type(std::move(other)) {}
|
||||
@ -55,7 +65,7 @@ namespace boost { namespace fusion
|
||||
template <
|
||||
typename ...U
|
||||
, typename = typename boost::enable_if_c<(
|
||||
fusion::detail::and_<is_convertible<U, T>...>::value &&
|
||||
fusion::detail::and_<is_convertible<U, T>...>::value &&
|
||||
sizeof...(U) >= 1
|
||||
)>::type
|
||||
>
|
||||
|
Reference in New Issue
Block a user