Add DISABLE_VARIADIC_VECTOR and SFINAE for c++11 tuple element construction

This commit is contained in:
Lee Clagett
2016-07-22 18:52:20 -04:00
parent 27321dd18e
commit 55150a7fa6
8 changed files with 257 additions and 2 deletions

View File

@ -20,12 +20,15 @@
///////////////////////////////////////////////////////////////////////////////
// C++11 interface
///////////////////////////////////////////////////////////////////////////////
#include <boost/core/enable_if.hpp>
#include <boost/fusion/container/vector/vector.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/fusion/sequence/intrinsic/value_at.hpp>
#include <boost/fusion/sequence/intrinsic/at.hpp>
#include <boost/fusion/sequence/comparison.hpp>
#include <boost/fusion/sequence/io.hpp>
#include <boost/fusion/support/detail/and.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <utility>
namespace boost { namespace fusion
@ -49,13 +52,29 @@ namespace boost { namespace fusion
tuple(tuple<U...>&& other)
: base_type(std::move(other)) {}
template <typename ...U>
template <
typename ...U
, typename = typename boost::enable_if_c<(
fusion::detail::and_<is_convertible<U, T>...>::value &&
sizeof...(U) >= 1
)>::type
>
/*BOOST_CONSTEXPR*/ BOOST_FUSION_GPU_ENABLED
explicit
tuple(U&&... args)
: base_type(std::forward<U>(args)...) {}
template <typename U>
template<typename U1, typename U2>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
tuple(std::pair<U1, U2> const& other)
: base_type(other.first, other.second) {}
template<typename U1, typename U2>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
tuple(std::pair<U1, U2>&& other)
: base_type(std::move(other.first), std::move(other.second)) {}
template<typename U>
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
tuple& operator=(U&& rhs)
{

View File

@ -12,6 +12,7 @@
#include <boost/fusion/container/vector/detail/config.hpp>
#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR) \
|| defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) \
|| (defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES))
# if defined(BOOST_FUSION_HAS_VARIADIC_TUPLE)
# undef BOOST_FUSION_HAS_VARIADIC_TUPLE