From b7d02a8c550cfe16ee3b72d8f6c3776cd826b0dc Mon Sep 17 00:00:00 2001 From: Joel de Guzman Date: Sun, 27 Jan 2013 07:17:01 +0000 Subject: [PATCH] + Fixes ticket #7914 + C++11 implementations for make_deque, deque_tie and as_deque [SVN r82630] --- .../boost/fusion/container/deque/convert.hpp | 94 +++++++++++++- .../container/deque/detail/convert_impl.hpp | 17 +-- .../detail/{as_deque.hpp => pp_as_deque.hpp} | 0 .../fusion/container/generation/deque_tie.hpp | 99 +++------------ .../generation/detail/pp_deque_tie.hpp | 105 ++++++++++++++++ .../generation/detail/pp_make_deque.hpp | 118 ++++++++++++++++++ .../container/generation/make_deque.hpp | 116 +++-------------- .../vector/detail/vector_forward_ctor.hpp | 3 +- .../container/vector/detail/vector_n.hpp | 36 ++++-- 9 files changed, 390 insertions(+), 198 deletions(-) rename include/boost/fusion/container/deque/detail/{as_deque.hpp => pp_as_deque.hpp} (100%) create mode 100644 include/boost/fusion/container/generation/detail/pp_deque_tie.hpp create mode 100644 include/boost/fusion/container/generation/detail/pp_make_deque.hpp diff --git a/include/boost/fusion/container/deque/convert.hpp b/include/boost/fusion/container/deque/convert.hpp index 1910cb84..33176dc9 100644 --- a/include/boost/fusion/container/deque/convert.hpp +++ b/include/boost/fusion/container/deque/convert.hpp @@ -1,5 +1,5 @@ /*============================================================================= - Copyright (c) 2005-2012 Joel de Guzman + Copyright (c) 2005-2013 Joel de Guzman Copyright (c) 2006 Dan Marsden Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -8,11 +8,100 @@ #if !defined(FUSION_CONVERT_20061213_2207) #define FUSION_CONVERT_20061213_2207 -#include #include #include + +#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE) + +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////////// +// C++11 variadic implementation +/////////////////////////////////////////////////////////////////////////////// +namespace boost { namespace fusion +{ + namespace detail + { + template ::value> + struct build_deque; + + template + struct build_deque + { + typedef deque<> type; + static type + call(First const&, Last const&) + { + return type(); + } + }; + + template + struct build_deque + { + typedef + build_deque::type, Last> + next_build_deque; + + typedef front_extended_deque< + typename next_build_deque::type + , typename result_of::value_of::type> + type; + + static type + call(First const& f, Last const& l) + { + typename result_of::value_of::type v = *f; + return type(next_build_deque::call(fusion::next(f), l), v); + } + }; + } + + namespace result_of + { + template + struct as_deque : + detail::build_deque< + typename result_of::begin::type + , typename result_of::end::type + > + { + }; + } + + template + inline typename result_of::as_deque::type + as_deque(Sequence& seq) + { + typedef typename result_of::as_deque::gen gen; + return gen::call(fusion::begin(seq), fusion::end(seq)); + } + + template + inline typename result_of::as_deque::type + as_deque(Sequence const& seq) + { + typedef typename result_of::as_deque::gen gen; + return gen::call(fusion::begin(seq), fusion::end(seq)); + } +}} + +#else + +/////////////////////////////////////////////////////////////////////////////// +// C++03 (non-variadic) implementation +/////////////////////////////////////////////////////////////////////////////// + #include #include +#include namespace boost { namespace fusion { @@ -48,3 +137,4 @@ namespace boost { namespace fusion }} #endif +#endif diff --git a/include/boost/fusion/container/deque/detail/convert_impl.hpp b/include/boost/fusion/container/deque/detail/convert_impl.hpp index 1401ef1a..5dff927a 100644 --- a/include/boost/fusion/container/deque/detail/convert_impl.hpp +++ b/include/boost/fusion/container/deque/detail/convert_impl.hpp @@ -8,7 +8,7 @@ #if !defined(FUSION_CONVERT_IMPL_20061213_2207) #define FUSION_CONVERT_IMPL_20061213_2207 -#include +#include #include #include #include @@ -17,6 +17,12 @@ namespace boost { namespace fusion { struct deque_tag; + namespace result_of + { + template + struct as_deque; + } + namespace extension { template @@ -28,14 +34,11 @@ namespace boost { namespace fusion template struct apply { - typedef detail::as_deque::value> gen; - typedef typename gen:: - template apply::type>::type - type; - + typedef result_of::as_deque gen; + typedef typename gen::type type; static type call(Sequence& seq) { - return gen::call(fusion::begin(seq)); + return gen::call(seq); } }; }; diff --git a/include/boost/fusion/container/deque/detail/as_deque.hpp b/include/boost/fusion/container/deque/detail/pp_as_deque.hpp similarity index 100% rename from include/boost/fusion/container/deque/detail/as_deque.hpp rename to include/boost/fusion/container/deque/detail/pp_as_deque.hpp diff --git a/include/boost/fusion/container/generation/deque_tie.hpp b/include/boost/fusion/container/generation/deque_tie.hpp index ea0afb92..132cad95 100644 --- a/include/boost/fusion/container/generation/deque_tie.hpp +++ b/include/boost/fusion/container/generation/deque_tie.hpp @@ -1,41 +1,23 @@ /*============================================================================= - Copyright (c) 2001-2011 Joel de Guzman - Copyright (c) 2006 Dan Marsden + Copyright (c) 2001-2013 Joel de Guzman Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ -#ifndef BOOST_PP_IS_ITERATING -#if !defined(FUSION_DEQUE_TIE_07192005_1242) -#define FUSION_DEQUE_TIE_07192005_1242 +#if !defined(FUSION_DEQUE_TIE_01272013_1401) +#define FUSION_DEQUE_TIE_01272013_1401 -#include -#include -#include -#include -#include -#include #include -#if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES) -#include +#if !defined(BOOST_FUSION_HAS_VARIADIC_DEQUE) +# include #else -#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES) -#pragma wave option(preserve: 2, line: 0, output: "detail/preprocessed/deque_tie" FUSION_MAX_DEQUE_SIZE_STR".hpp") -#endif -/*============================================================================= - Copyright (c) 2001-2011 Joel de Guzman +/////////////////////////////////////////////////////////////////////////////// +// C++11 variadic interface +/////////////////////////////////////////////////////////////////////////////// - Distributed under the Boost Software License, Version 1.0. (See accompanying - file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - - This is an auto-generated file. Do not edit! -==============================================================================*/ - -#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES) -#pragma wave option(preserve: 1) -#endif +#include namespace boost { namespace fusion { @@ -43,63 +25,20 @@ namespace boost { namespace fusion namespace result_of { - template < - BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT( - FUSION_MAX_DEQUE_SIZE, typename T, void_) - , typename Extra = void_ - > - struct deque_tie; - } - -#define BOOST_FUSION_REF(z, n, data) BOOST_PP_CAT(T, n)& - -#define BOOST_PP_FILENAME_1 -#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_DEQUE_SIZE) -#include BOOST_PP_ITERATE() - -#undef BOOST_FUSION_REF - -}} - -#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES) -#pragma wave option(output: null) -#endif - -#endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES - -#endif -#else // defined(BOOST_PP_IS_ITERATING) -/////////////////////////////////////////////////////////////////////////////// -// -// Preprocessor vertical repetition code -// -/////////////////////////////////////////////////////////////////////////////// - -#define N BOOST_PP_ITERATION() - - namespace result_of - { - template -#if defined(BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS) - #define TEXT(z, n, text) , text - struct deque_tie< BOOST_PP_ENUM_PARAMS(N, T) BOOST_PP_REPEAT_FROM_TO(BOOST_PP_DEC(N), FUSION_MAX_DEQUE_SIZE, TEXT, void_) > - #undef TEXT -#else - struct deque_tie -#endif + template + struct deque_tie { - typedef deque type; + typedef deque type; }; } - template - inline deque - deque_tie(BOOST_PP_ENUM_BINARY_PARAMS(N, T, & _)) + template + inline deque + deque_tie(T&... arg) { - return deque( - BOOST_PP_ENUM_PARAMS(N, _)); + return deque(arg...); } + }} -#undef N -#endif // defined(BOOST_PP_IS_ITERATING) - +#endif +#endif \ No newline at end of file diff --git a/include/boost/fusion/container/generation/detail/pp_deque_tie.hpp b/include/boost/fusion/container/generation/detail/pp_deque_tie.hpp new file mode 100644 index 00000000..ea0afb92 --- /dev/null +++ b/include/boost/fusion/container/generation/detail/pp_deque_tie.hpp @@ -0,0 +1,105 @@ +/*============================================================================= + Copyright (c) 2001-2011 Joel de Guzman + Copyright (c) 2006 Dan Marsden + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#ifndef BOOST_PP_IS_ITERATING +#if !defined(FUSION_DEQUE_TIE_07192005_1242) +#define FUSION_DEQUE_TIE_07192005_1242 + +#include +#include +#include +#include +#include +#include +#include + +#if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES) +#include +#else +#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES) +#pragma wave option(preserve: 2, line: 0, output: "detail/preprocessed/deque_tie" FUSION_MAX_DEQUE_SIZE_STR".hpp") +#endif + +/*============================================================================= + Copyright (c) 2001-2011 Joel de Guzman + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + This is an auto-generated file. Do not edit! +==============================================================================*/ + +#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES) +#pragma wave option(preserve: 1) +#endif + +namespace boost { namespace fusion +{ + struct void_; + + namespace result_of + { + template < + BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT( + FUSION_MAX_DEQUE_SIZE, typename T, void_) + , typename Extra = void_ + > + struct deque_tie; + } + +#define BOOST_FUSION_REF(z, n, data) BOOST_PP_CAT(T, n)& + +#define BOOST_PP_FILENAME_1 +#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_DEQUE_SIZE) +#include BOOST_PP_ITERATE() + +#undef BOOST_FUSION_REF + +}} + +#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES) +#pragma wave option(output: null) +#endif + +#endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES + +#endif +#else // defined(BOOST_PP_IS_ITERATING) +/////////////////////////////////////////////////////////////////////////////// +// +// Preprocessor vertical repetition code +// +/////////////////////////////////////////////////////////////////////////////// + +#define N BOOST_PP_ITERATION() + + namespace result_of + { + template +#if defined(BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS) + #define TEXT(z, n, text) , text + struct deque_tie< BOOST_PP_ENUM_PARAMS(N, T) BOOST_PP_REPEAT_FROM_TO(BOOST_PP_DEC(N), FUSION_MAX_DEQUE_SIZE, TEXT, void_) > + #undef TEXT +#else + struct deque_tie +#endif + { + typedef deque type; + }; + } + + template + inline deque + deque_tie(BOOST_PP_ENUM_BINARY_PARAMS(N, T, & _)) + { + return deque( + BOOST_PP_ENUM_PARAMS(N, _)); + } + +#undef N +#endif // defined(BOOST_PP_IS_ITERATING) + diff --git a/include/boost/fusion/container/generation/detail/pp_make_deque.hpp b/include/boost/fusion/container/generation/detail/pp_make_deque.hpp new file mode 100644 index 00000000..588a5aee --- /dev/null +++ b/include/boost/fusion/container/generation/detail/pp_make_deque.hpp @@ -0,0 +1,118 @@ +/*============================================================================= + Copyright (c) 2001-2011 Joel de Guzman + Copyright (c) 2006 Dan Marsden + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#ifndef BOOST_PP_IS_ITERATING +#if !defined(FUSION_MAKE_DEQUE_07162005_0243) +#define FUSION_MAKE_DEQUE_07162005_0243 + +#include +#include +#include +#include +#include +#include +#include + +#if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES) +#include +#else +#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES) +#pragma wave option(preserve: 2, line: 0, output: "detail/preprocessed/make_deque" FUSION_MAX_DEQUE_SIZE_STR".hpp") +#endif + +/*============================================================================= + Copyright (c) 2001-2011 Joel de Guzman + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + This is an auto-generated file. Do not edit! +==============================================================================*/ + +#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES) +#pragma wave option(preserve: 1) +#endif + +namespace boost { namespace fusion +{ + struct void_; + + namespace result_of + { + template < + BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT( + FUSION_MAX_DEQUE_SIZE, typename T, void_) + , typename Extra = void_ + > + struct make_deque; + + template <> + struct make_deque<> + { + typedef deque<> type; + }; + } + + inline deque<> + make_deque() + { + return deque<>(); + } + +#define BOOST_FUSION_AS_FUSION_ELEMENT(z, n, data) \ + typename detail::as_fusion_element::type + +#define BOOST_PP_FILENAME_1 +#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_DEQUE_SIZE) +#include BOOST_PP_ITERATE() + +#undef BOOST_FUSION_AS_FUSION_ELEMENT + +}} + +#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES) +#pragma wave option(output: null) +#endif + +#endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES + +#endif +#else // defined(BOOST_PP_IS_ITERATING) +/////////////////////////////////////////////////////////////////////////////// +// +// Preprocessor vertical repetition code +// +/////////////////////////////////////////////////////////////////////////////// + +#define N BOOST_PP_ITERATION() + + namespace result_of + { + template +#if defined(BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS) + #define TEXT(z, n, text) , text + struct make_deque< BOOST_PP_ENUM_PARAMS(N, T) BOOST_PP_REPEAT_FROM_TO(BOOST_PP_DEC(N), FUSION_MAX_DEQUE_SIZE, TEXT, void_) > + #undef TEXT +#else + struct make_deque +#endif + { + typedef deque type; + }; + } + + template + inline deque + make_deque(BOOST_PP_ENUM_BINARY_PARAMS(N, T, const& _)) + { + return deque( + BOOST_PP_ENUM_PARAMS(N, _)); + } + +#undef N +#endif // defined(BOOST_PP_IS_ITERATING) + diff --git a/include/boost/fusion/container/generation/make_deque.hpp b/include/boost/fusion/container/generation/make_deque.hpp index fdc7dce7..4fc07efe 100644 --- a/include/boost/fusion/container/generation/make_deque.hpp +++ b/include/boost/fusion/container/generation/make_deque.hpp @@ -1,47 +1,23 @@ /*============================================================================= - Copyright (c) 2001-2011 Joel de Guzman - Copyright (c) 2006 Dan Marsden + Copyright (c) 2001-2013 Joel de Guzman Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ -/*============================================================================= - Copyright (c) 2001-2011 Joel de Guzman +#if !defined(FUSION_MAKE_DEQUE_01272013_1401) +#define FUSION_MAKE_DEQUE_01272013_1401 - Distributed under the Boost Software License, Version 1.0. (See accompanying - file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -==============================================================================*/ -#ifndef BOOST_PP_IS_ITERATING -#if !defined(FUSION_MAKE_DEQUE_07162005_0243) -#define FUSION_MAKE_DEQUE_07162005_0243 - -#include -#include -#include -#include -#include #include -#include -#if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES) -#include +#if !defined(BOOST_FUSION_HAS_VARIADIC_DEQUE) +# include #else -#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES) -#pragma wave option(preserve: 2, line: 0, output: "detail/preprocessed/make_deque" FUSION_MAX_DEQUE_SIZE_STR".hpp") -#endif -/*============================================================================= - Copyright (c) 2001-2011 Joel de Guzman +/////////////////////////////////////////////////////////////////////////////// +// C++11 variadic interface +/////////////////////////////////////////////////////////////////////////////// - Distributed under the Boost Software License, Version 1.0. (See accompanying - file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - - This is an auto-generated file. Do not edit! -==============================================================================*/ - -#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES) -#pragma wave option(preserve: 1) -#endif +#include namespace boost { namespace fusion { @@ -49,76 +25,20 @@ namespace boost { namespace fusion namespace result_of { - template < - BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT( - FUSION_MAX_DEQUE_SIZE, typename T, void_) - , typename Extra = void_ - > - struct make_deque; - - template <> - struct make_deque<> + template + struct make_deque { - typedef deque<> type; + typedef deque type; }; } - inline deque<> - make_deque() + template + inline deque::type...> + make_deque(T const&... arg) { - return deque<>(); + return deque::type...>(arg...); } - -#define BOOST_FUSION_AS_FUSION_ELEMENT(z, n, data) \ - typename detail::as_fusion_element::type - -#define BOOST_PP_FILENAME_1 -#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_DEQUE_SIZE) -#include BOOST_PP_ITERATE() - -#undef BOOST_FUSION_AS_FUSION_ELEMENT - -}} - -#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES) -#pragma wave option(output: null) -#endif - -#endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES + }} #endif -#else // defined(BOOST_PP_IS_ITERATING) -/////////////////////////////////////////////////////////////////////////////// -// -// Preprocessor vertical repetition code -// -/////////////////////////////////////////////////////////////////////////////// - -#define N BOOST_PP_ITERATION() - - namespace result_of - { - template -#if defined(BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS) - #define TEXT(z, n, text) , text - struct make_deque< BOOST_PP_ENUM_PARAMS(N, T) BOOST_PP_REPEAT_FROM_TO(BOOST_PP_DEC(N), FUSION_MAX_DEQUE_SIZE, TEXT, void_) > - #undef TEXT -#else - struct make_deque -#endif - { - typedef deque type; - }; - } - - template - inline deque - make_deque(BOOST_PP_ENUM_BINARY_PARAMS(N, T, const& _)) - { - return deque( - BOOST_PP_ENUM_PARAMS(N, _)); - } - -#undef N -#endif // defined(BOOST_PP_IS_ITERATING) - +#endif \ No newline at end of file diff --git a/include/boost/fusion/container/vector/detail/vector_forward_ctor.hpp b/include/boost/fusion/container/vector/detail/vector_forward_ctor.hpp index 512d7bde..cc7a1e41 100644 --- a/include/boost/fusion/container/vector/detail/vector_forward_ctor.hpp +++ b/include/boost/fusion/container/vector/detail/vector_forward_ctor.hpp @@ -38,10 +38,11 @@ : vec(BOOST_PP_ENUM_PARAMS(N, _)) {} #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + template #if N == 1 explicit #endif - vector(BOOST_PP_ENUM_BINARY_PARAMS(N, T, && _)) + vector(BOOST_PP_ENUM_BINARY_PARAMS(N, U, && _)) : vec(BOOST_PP_ENUM(N, FUSION_FORWARD_CTOR_MOVE, _)) {} #endif diff --git a/include/boost/fusion/container/vector/detail/vector_n.hpp b/include/boost/fusion/container/vector/detail/vector_n.hpp index e3d5e13f..5cb76c12 100644 --- a/include/boost/fusion/container/vector/detail/vector_n.hpp +++ b/include/boost/fusion/container/vector/detail/vector_n.hpp @@ -9,13 +9,13 @@ #if !defined(FUSION_MACRO_05042005) #define FUSION_MACRO_05042005 -#define FUSION_VECTOR_MEMBER_MEMBER_DEFAULT_INIT(z, n, _) m##n() -#define FUSION_VECTOR_MEMBER_MEMBER_INIT(z, n, _) m##n(_##n) +#define FUSION_VECTOR_MEMBER_DEFAULT_INIT(z, n, _) m##n() +#define FUSION_VECTOR_MEMBER_INIT(z, n, _) m##n(_##n) #define FUSION_VECTOR_MEMBER_COPY_INIT(z, n, _) m##n(other.m##n) #define FUSION_VECTOR_MEMBER_FWD(z, n, _) m##n(std::forward(other.m##n)) -#define FUSION_VECTOR_ARG_FWD(z, n, _) m##n(std::forward(_##n)) +#define FUSION_VECTOR_ARG_FWD(z, n, _) m##n(std::forward(_##n)) #define FUSION_VECTOR_MEMBER_MEMBER_DECL(z, n, _) T##n m##n; -#define FUSION_VECTOR_MEMBER_FORWARD(z, n, _) std::forward(_##n) +#define FUSION_VECTOR_MEMBER_FORWARD(z, n, _) std::forward(_##n) #define FUSION_VECTOR_MEMBER_MEMBER_ASSIGN(z, n, _) \ this->BOOST_PP_CAT(m, n) = vec.BOOST_PP_CAT(m, n); @@ -47,17 +47,18 @@ struct BOOST_PP_CAT(vector_data, N) { BOOST_PP_CAT(vector_data, N)() - : BOOST_PP_ENUM(N, FUSION_VECTOR_MEMBER_MEMBER_DEFAULT_INIT, _) {} + : BOOST_PP_ENUM(N, FUSION_VECTOR_MEMBER_DEFAULT_INIT, _) {} #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) - BOOST_PP_CAT(vector_data, N)(BOOST_PP_ENUM_BINARY_PARAMS(N, T, && _)) + template + BOOST_PP_CAT(vector_data, N)(BOOST_PP_ENUM_BINARY_PARAMS(N, U, && _)) : BOOST_PP_ENUM(N, FUSION_VECTOR_ARG_FWD, _) {} #endif BOOST_PP_CAT(vector_data, N)( BOOST_PP_ENUM_BINARY_PARAMS( N, typename detail::call_param::type _)) - : BOOST_PP_ENUM(N, FUSION_VECTOR_MEMBER_MEMBER_INIT, _) {} + : BOOST_PP_ENUM(N, FUSION_VECTOR_MEMBER_INIT, _) {} BOOST_PP_CAT(vector_data, N)( BOOST_PP_CAT(vector_data, N) const& other) @@ -124,16 +125,24 @@ : base_type(BOOST_PP_ENUM_PARAMS(N, _)) {} #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + template #if (N == 1) explicit -#endif - BOOST_PP_CAT(vector, N)(BOOST_PP_ENUM_BINARY_PARAMS(N, T, && _)) + BOOST_PP_CAT(vector, N)(U0&& _0 + , typename boost::enable_if >::type* /*dummy*/ = 0 + ) + : base_type(std::forward(_0)) {} +#else + BOOST_PP_CAT(vector, N)(BOOST_PP_ENUM_BINARY_PARAMS(N, U, && _)) : base_type(BOOST_PP_ENUM(N, FUSION_VECTOR_MEMBER_FORWARD, _)) {} #endif -#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) BOOST_PP_CAT(vector, N)(BOOST_PP_CAT(vector, N)&& rhs) : base_type(std::forward(rhs)) {} + + BOOST_PP_CAT(vector, N)(BOOST_PP_CAT(vector, N) const& rhs) + : base_type(rhs) {} + #endif template @@ -179,6 +188,13 @@ } #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + BOOST_PP_CAT(vector, N)& + operator=(BOOST_PP_CAT(vector, N) const& vec) + { + base_type::operator=(*this); + return *this; + } + BOOST_PP_CAT(vector, N)& operator=(BOOST_PP_CAT(vector, N)&& vec) {