+ Fixes ticket #7914

+ C++11 implementations for make_deque, deque_tie and as_deque

[SVN r82630]
This commit is contained in:
Joel de Guzman
2013-01-27 07:17:01 +00:00
parent 6a47d86d72
commit b7d02a8c55
9 changed files with 390 additions and 198 deletions

View File

@ -1,5 +1,5 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2005-2012 Joel de Guzman Copyright (c) 2005-2013 Joel de Guzman
Copyright (c) 2006 Dan Marsden Copyright (c) 2006 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying Distributed under the Boost Software License, Version 1.0. (See accompanying
@ -8,11 +8,100 @@
#if !defined(FUSION_CONVERT_20061213_2207) #if !defined(FUSION_CONVERT_20061213_2207)
#define FUSION_CONVERT_20061213_2207 #define FUSION_CONVERT_20061213_2207
#include <boost/fusion/container/deque/detail/as_deque.hpp>
#include <boost/fusion/container/deque/detail/convert_impl.hpp> #include <boost/fusion/container/deque/detail/convert_impl.hpp>
#include <boost/fusion/container/deque/deque.hpp> #include <boost/fusion/container/deque/deque.hpp>
#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
#include <boost/fusion/iterator/equal_to.hpp>
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/value_of.hpp>
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/fusion/container/deque/front_extended_deque.hpp>
///////////////////////////////////////////////////////////////////////////////
// C++11 variadic implementation
///////////////////////////////////////////////////////////////////////////////
namespace boost { namespace fusion
{
namespace detail
{
template <typename First, typename Last
, bool is_empty = result_of::equal_to<First, Last>::value>
struct build_deque;
template <typename First, typename Last>
struct build_deque<First, Last, true>
{
typedef deque<> type;
static type
call(First const&, Last const&)
{
return type();
}
};
template <typename First, typename Last>
struct build_deque<First, Last, false>
{
typedef
build_deque<typename result_of::next<First>::type, Last>
next_build_deque;
typedef front_extended_deque<
typename next_build_deque::type
, typename result_of::value_of<First>::type>
type;
static type
call(First const& f, Last const& l)
{
typename result_of::value_of<First>::type v = *f;
return type(next_build_deque::call(fusion::next(f), l), v);
}
};
}
namespace result_of
{
template <typename Sequence>
struct as_deque :
detail::build_deque<
typename result_of::begin<Sequence>::type
, typename result_of::end<Sequence>::type
>
{
};
}
template <typename Sequence>
inline typename result_of::as_deque<Sequence>::type
as_deque(Sequence& seq)
{
typedef typename result_of::as_deque<Sequence>::gen gen;
return gen::call(fusion::begin(seq), fusion::end(seq));
}
template <typename Sequence>
inline typename result_of::as_deque<Sequence const>::type
as_deque(Sequence const& seq)
{
typedef typename result_of::as_deque<Sequence const>::gen gen;
return gen::call(fusion::begin(seq), fusion::end(seq));
}
}}
#else
///////////////////////////////////////////////////////////////////////////////
// C++03 (non-variadic) implementation
///////////////////////////////////////////////////////////////////////////////
#include <boost/fusion/sequence/intrinsic/begin.hpp> #include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp> #include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/fusion/container/deque/detail/pp_as_deque.hpp>
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
@ -48,3 +137,4 @@ namespace boost { namespace fusion
}} }}
#endif #endif
#endif

View File

@ -8,7 +8,7 @@
#if !defined(FUSION_CONVERT_IMPL_20061213_2207) #if !defined(FUSION_CONVERT_IMPL_20061213_2207)
#define FUSION_CONVERT_IMPL_20061213_2207 #define FUSION_CONVERT_IMPL_20061213_2207
#include <boost/fusion/container/deque/detail/as_deque.hpp> #include <boost/fusion/container/deque/convert.hpp>
#include <boost/fusion/container/deque/deque.hpp> #include <boost/fusion/container/deque/deque.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp> #include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp> #include <boost/fusion/sequence/intrinsic/size.hpp>
@ -17,6 +17,12 @@ namespace boost { namespace fusion
{ {
struct deque_tag; struct deque_tag;
namespace result_of
{
template <typename Sequence>
struct as_deque;
}
namespace extension namespace extension
{ {
template <typename T> template <typename T>
@ -28,14 +34,11 @@ namespace boost { namespace fusion
template <typename Sequence> template <typename Sequence>
struct apply struct apply
{ {
typedef detail::as_deque<result_of::size<Sequence>::value> gen; typedef result_of::as_deque<Sequence> gen;
typedef typename gen:: typedef typename gen::type type;
template apply<typename result_of::begin<Sequence>::type>::type
type;
static type call(Sequence& seq) static type call(Sequence& seq)
{ {
return gen::call(fusion::begin(seq)); return gen::call(seq);
} }
}; };
}; };

View File

@ -1,41 +1,23 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman Copyright (c) 2001-2013 Joel de Guzman
Copyright (c) 2006 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying 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) 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_01272013_1401)
#if !defined(FUSION_DEQUE_TIE_07192005_1242) #define FUSION_DEQUE_TIE_01272013_1401
#define FUSION_DEQUE_TIE_07192005_1242
#include <boost/preprocessor/iterate.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
#include <boost/fusion/container/deque/deque.hpp> #include <boost/fusion/container/deque/deque.hpp>
#if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES) #if !defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
#include <boost/fusion/container/generation/detail/preprocessed/deque_tie.hpp> # include <boost/fusion/container/generation/detail/pp_deque_tie.hpp>
#else #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 #include <boost/fusion/support/detail/as_fusion_element.hpp>
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 namespace boost { namespace fusion
{ {
@ -43,63 +25,20 @@ namespace boost { namespace fusion
namespace result_of namespace result_of
{ {
template < template <typename ...T>
BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT( struct deque_tie
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 <boost/fusion/container/generation/deque_tie.hpp>
#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 <BOOST_PP_ENUM_PARAMS(N, typename T)>
#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<BOOST_PP_ENUM_PARAMS(N, T)>
#endif
{ {
typedef deque<BOOST_PP_ENUM(N, BOOST_FUSION_REF, _)> type; typedef deque<T&...> type;
}; };
} }
template <BOOST_PP_ENUM_PARAMS(N, typename T)> template <typename ...T>
inline deque<BOOST_PP_ENUM(N, BOOST_FUSION_REF, _)> inline deque<T&...>
deque_tie(BOOST_PP_ENUM_BINARY_PARAMS(N, T, & _)) deque_tie(T&... arg)
{ {
return deque<BOOST_PP_ENUM(N, BOOST_FUSION_REF, _)>( return deque<T&...>(arg...);
BOOST_PP_ENUM_PARAMS(N, _));
} }
}}
#undef N #endif
#endif // defined(BOOST_PP_IS_ITERATING) #endif

View File

@ -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 <boost/preprocessor/iterate.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
#include <boost/fusion/container/deque/deque.hpp>
#if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
#include <boost/fusion/container/generation/detail/preprocessed/deque_tie.hpp>
#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 <boost/fusion/container/generation/deque_tie.hpp>
#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 <BOOST_PP_ENUM_PARAMS(N, typename T)>
#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<BOOST_PP_ENUM_PARAMS(N, T)>
#endif
{
typedef deque<BOOST_PP_ENUM(N, BOOST_FUSION_REF, _)> type;
};
}
template <BOOST_PP_ENUM_PARAMS(N, typename T)>
inline deque<BOOST_PP_ENUM(N, BOOST_FUSION_REF, _)>
deque_tie(BOOST_PP_ENUM_BINARY_PARAMS(N, T, & _))
{
return deque<BOOST_PP_ENUM(N, BOOST_FUSION_REF, _)>(
BOOST_PP_ENUM_PARAMS(N, _));
}
#undef N
#endif // defined(BOOST_PP_IS_ITERATING)

View File

@ -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 <boost/preprocessor/iterate.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
#include <boost/fusion/container/deque/deque.hpp>
#include <boost/fusion/support/detail/as_fusion_element.hpp>
#if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
#include <boost/fusion/container/generation/detail/preprocessed/make_deque.hpp>
#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<BOOST_PP_CAT(T, n)>::type
#define BOOST_PP_FILENAME_1 <boost/fusion/container/generation/make_deque.hpp>
#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 <BOOST_PP_ENUM_PARAMS(N, typename T)>
#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<BOOST_PP_ENUM_PARAMS(N, T)>
#endif
{
typedef deque<BOOST_PP_ENUM(N, BOOST_FUSION_AS_FUSION_ELEMENT, _)> type;
};
}
template <BOOST_PP_ENUM_PARAMS(N, typename T)>
inline deque<BOOST_PP_ENUM(N, BOOST_FUSION_AS_FUSION_ELEMENT, _)>
make_deque(BOOST_PP_ENUM_BINARY_PARAMS(N, T, const& _))
{
return deque<BOOST_PP_ENUM(N, BOOST_FUSION_AS_FUSION_ELEMENT, _)>(
BOOST_PP_ENUM_PARAMS(N, _));
}
#undef N
#endif // defined(BOOST_PP_IS_ITERATING)

View File

@ -1,47 +1,23 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman Copyright (c) 2001-2013 Joel de Guzman
Copyright (c) 2006 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying 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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/ ==============================================================================*/
/*============================================================================= #if !defined(FUSION_MAKE_DEQUE_01272013_1401)
Copyright (c) 2001-2011 Joel de Guzman #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 <boost/preprocessor/iterate.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
#include <boost/fusion/container/deque/deque.hpp> #include <boost/fusion/container/deque/deque.hpp>
#include <boost/fusion/support/detail/as_fusion_element.hpp>
#if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES) #if !defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
#include <boost/fusion/container/generation/detail/preprocessed/make_deque.hpp> # include <boost/fusion/container/generation/detail/pp_make_deque.hpp>
#else #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 #include <boost/fusion/support/detail/as_fusion_element.hpp>
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 namespace boost { namespace fusion
{ {
@ -49,76 +25,20 @@ namespace boost { namespace fusion
namespace result_of namespace result_of
{ {
template < template <typename ...T>
BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT( struct make_deque
FUSION_MAX_DEQUE_SIZE, typename T, void_)
, typename Extra = void_
>
struct make_deque;
template <>
struct make_deque<>
{ {
typedef deque<> type; typedef deque<T...> type;
}; };
} }
inline deque<> template <typename ...T>
make_deque() inline deque<typename detail::as_fusion_element<T>::type...>
make_deque(T const&... arg)
{ {
return deque<>(); return deque<typename detail::as_fusion_element<T>::type...>(arg...);
} }
}}
#define BOOST_FUSION_AS_FUSION_ELEMENT(z, n, data) \
typename detail::as_fusion_element<BOOST_PP_CAT(T, n)>::type
#define BOOST_PP_FILENAME_1 <boost/fusion/container/generation/make_deque.hpp>
#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 #endif
#else // defined(BOOST_PP_IS_ITERATING) #endif
///////////////////////////////////////////////////////////////////////////////
//
// Preprocessor vertical repetition code
//
///////////////////////////////////////////////////////////////////////////////
#define N BOOST_PP_ITERATION()
namespace result_of
{
template <BOOST_PP_ENUM_PARAMS(N, typename T)>
#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<BOOST_PP_ENUM_PARAMS(N, T)>
#endif
{
typedef deque<BOOST_PP_ENUM(N, BOOST_FUSION_AS_FUSION_ELEMENT, _)> type;
};
}
template <BOOST_PP_ENUM_PARAMS(N, typename T)>
inline deque<BOOST_PP_ENUM(N, BOOST_FUSION_AS_FUSION_ELEMENT, _)>
make_deque(BOOST_PP_ENUM_BINARY_PARAMS(N, T, const& _))
{
return deque<BOOST_PP_ENUM(N, BOOST_FUSION_AS_FUSION_ELEMENT, _)>(
BOOST_PP_ENUM_PARAMS(N, _));
}
#undef N
#endif // defined(BOOST_PP_IS_ITERATING)

View File

@ -38,10 +38,11 @@
: vec(BOOST_PP_ENUM_PARAMS(N, _)) {} : vec(BOOST_PP_ENUM_PARAMS(N, _)) {}
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template <BOOST_PP_ENUM_PARAMS(N, typename U)>
#if N == 1 #if N == 1
explicit explicit
#endif #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, _)) {} : vec(BOOST_PP_ENUM(N, FUSION_FORWARD_CTOR_MOVE, _)) {}
#endif #endif

View File

@ -9,13 +9,13 @@
#if !defined(FUSION_MACRO_05042005) #if !defined(FUSION_MACRO_05042005)
#define FUSION_MACRO_05042005 #define FUSION_MACRO_05042005
#define FUSION_VECTOR_MEMBER_MEMBER_DEFAULT_INIT(z, n, _) m##n() #define FUSION_VECTOR_MEMBER_DEFAULT_INIT(z, n, _) m##n()
#define FUSION_VECTOR_MEMBER_MEMBER_INIT(z, n, _) m##n(_##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_COPY_INIT(z, n, _) m##n(other.m##n)
#define FUSION_VECTOR_MEMBER_FWD(z, n, _) m##n(std::forward<T##n>(other.m##n)) #define FUSION_VECTOR_MEMBER_FWD(z, n, _) m##n(std::forward<T##n>(other.m##n))
#define FUSION_VECTOR_ARG_FWD(z, n, _) m##n(std::forward<T##n>(_##n)) #define FUSION_VECTOR_ARG_FWD(z, n, _) m##n(std::forward<U##n>(_##n))
#define FUSION_VECTOR_MEMBER_MEMBER_DECL(z, n, _) T##n m##n; #define FUSION_VECTOR_MEMBER_MEMBER_DECL(z, n, _) T##n m##n;
#define FUSION_VECTOR_MEMBER_FORWARD(z, n, _) std::forward<T##n>(_##n) #define FUSION_VECTOR_MEMBER_FORWARD(z, n, _) std::forward<U##n>(_##n)
#define FUSION_VECTOR_MEMBER_MEMBER_ASSIGN(z, n, _) \ #define FUSION_VECTOR_MEMBER_MEMBER_ASSIGN(z, n, _) \
this->BOOST_PP_CAT(m, n) = vec.BOOST_PP_CAT(m, n); this->BOOST_PP_CAT(m, n) = vec.BOOST_PP_CAT(m, n);
@ -47,17 +47,18 @@
struct BOOST_PP_CAT(vector_data, N) struct BOOST_PP_CAT(vector_data, N)
{ {
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) #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
BOOST_PP_CAT(vector_data, N)(BOOST_PP_ENUM_BINARY_PARAMS(N, T, && _)) template <BOOST_PP_ENUM_PARAMS(N, typename U)>
BOOST_PP_CAT(vector_data, N)(BOOST_PP_ENUM_BINARY_PARAMS(N, U, && _))
: BOOST_PP_ENUM(N, FUSION_VECTOR_ARG_FWD, _) {} : BOOST_PP_ENUM(N, FUSION_VECTOR_ARG_FWD, _) {}
#endif #endif
BOOST_PP_CAT(vector_data, N)( BOOST_PP_CAT(vector_data, N)(
BOOST_PP_ENUM_BINARY_PARAMS( BOOST_PP_ENUM_BINARY_PARAMS(
N, typename detail::call_param<T, >::type _)) N, typename detail::call_param<T, >::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)(
BOOST_PP_CAT(vector_data, N) const& other) BOOST_PP_CAT(vector_data, N) const& other)
@ -124,16 +125,24 @@
: base_type(BOOST_PP_ENUM_PARAMS(N, _)) {} : base_type(BOOST_PP_ENUM_PARAMS(N, _)) {}
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template <BOOST_PP_ENUM_PARAMS(N, typename U)>
#if (N == 1) #if (N == 1)
explicit explicit
#endif BOOST_PP_CAT(vector, N)(U0&& _0
BOOST_PP_CAT(vector, N)(BOOST_PP_ENUM_BINARY_PARAMS(N, T, && _)) , typename boost::enable_if<is_convertible<U0, T0> >::type* /*dummy*/ = 0
)
: base_type(std::forward<U0>(_0)) {}
#else
BOOST_PP_CAT(vector, N)(BOOST_PP_ENUM_BINARY_PARAMS(N, U, && _))
: base_type(BOOST_PP_ENUM(N, FUSION_VECTOR_MEMBER_FORWARD, _)) {} : base_type(BOOST_PP_ENUM(N, FUSION_VECTOR_MEMBER_FORWARD, _)) {}
#endif #endif
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
BOOST_PP_CAT(vector, N)(BOOST_PP_CAT(vector, N)&& rhs) BOOST_PP_CAT(vector, N)(BOOST_PP_CAT(vector, N)&& rhs)
: base_type(std::forward<base_type>(rhs)) {} : base_type(std::forward<base_type>(rhs)) {}
BOOST_PP_CAT(vector, N)(BOOST_PP_CAT(vector, N) const& rhs)
: base_type(rhs) {}
#endif #endif
template <BOOST_PP_ENUM_PARAMS(N, typename U)> template <BOOST_PP_ENUM_PARAMS(N, typename U)>
@ -179,6 +188,13 @@
} }
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) #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)& BOOST_PP_CAT(vector, N)&
operator=(BOOST_PP_CAT(vector, N)&& vec) operator=(BOOST_PP_CAT(vector, N)&& vec)
{ {