forked from boostorg/fusion
Merge from trunk
[SVN r81061]
This commit is contained in:
@ -11,24 +11,23 @@
|
||||
#include <boost/config.hpp>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// With no decltype and variadics, we will use the C++03 version
|
||||
// With variadics, we will use the PP version version
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#if (defined(BOOST_NO_DECLTYPE) \
|
||||
|| defined(BOOST_NO_VARIADIC_TEMPLATES) \
|
||||
|| defined(BOOST_NO_RVALUE_REFERENCES))
|
||||
# include <boost/fusion/container/deque/detail/cpp03_deque.hpp>
|
||||
#if defined(BOOST_NO_VARIADIC_TEMPLATES)
|
||||
# include <boost/fusion/container/deque/detail/pp_deque.hpp>
|
||||
#else
|
||||
# if !defined(BOOST_FUSION_HAS_CPP11_DEQUE)
|
||||
# define BOOST_FUSION_HAS_CPP11_DEQUE
|
||||
# if !defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
|
||||
# define BOOST_FUSION_HAS_VARIADIC_DEQUE
|
||||
# endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// C++11 interface
|
||||
// C++11 variadic interface
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/fusion/support/sequence_base.hpp>
|
||||
#include <boost/fusion/support/detail/access.hpp>
|
||||
#include <boost/fusion/support/is_sequence.hpp>
|
||||
#include <boost/fusion/container/deque/detail/keyed_element.hpp>
|
||||
#include <boost/fusion/container/deque/detail/cpp11_deque_keyed_values.hpp>
|
||||
#include <boost/fusion/container/deque/detail/variadic_deque_keyed_values.hpp>
|
||||
#include <boost/fusion/container/deque/deque_fwd.hpp>
|
||||
#include <boost/fusion/container/deque/detail/value_at_impl.hpp>
|
||||
#include <boost/fusion/container/deque/detail/at_impl.hpp>
|
||||
@ -36,8 +35,10 @@
|
||||
#include <boost/fusion/container/deque/detail/end_impl.hpp>
|
||||
#include <boost/fusion/container/deque/detail/is_sequence_impl.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/empty.hpp>
|
||||
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
|
||||
@ -48,6 +49,22 @@ namespace boost { namespace fusion
|
||||
template <typename ...Elements>
|
||||
struct deque : detail::nil_keyed_element
|
||||
{
|
||||
typedef deque_tag fusion_tag;
|
||||
typedef bidirectional_traversal_tag category;
|
||||
typedef mpl::int_<0> size;
|
||||
typedef mpl::int_<0> next_up;
|
||||
typedef mpl::int_<0> next_down;
|
||||
typedef mpl::false_ is_view;
|
||||
|
||||
template <typename Sequence>
|
||||
deque(Sequence const&,
|
||||
typename enable_if<
|
||||
mpl::and_<
|
||||
traits::is_sequence<Sequence>
|
||||
, result_of::empty<Sequence>>>::type* /*dummy*/ = 0)
|
||||
{}
|
||||
|
||||
deque() {}
|
||||
};
|
||||
|
||||
template <typename Head, typename ...Tail>
|
||||
@ -60,7 +77,7 @@ namespace boost { namespace fusion
|
||||
typedef typename detail::deque_keyed_values<Head, Tail...>::type base;
|
||||
typedef mpl::int_<(sizeof ...(Tail) + 1)> size;
|
||||
typedef mpl::int_<size::value> next_up;
|
||||
typedef mpl::int_<mpl::int_<((size::value == 0) ? 0 : -1)>::type::value> next_down;
|
||||
typedef mpl::int_<((size::value == 0) ? 0 : -1)> next_down;
|
||||
typedef mpl::false_ is_view;
|
||||
|
||||
deque()
|
||||
@ -71,11 +88,45 @@ namespace boost { namespace fusion
|
||||
: base(seq)
|
||||
{}
|
||||
|
||||
explicit deque(typename detail::call_param<Head>::type head
|
||||
, typename detail::call_param<Tail>::type... tail)
|
||||
: base(detail::deque_keyed_values<Head, Tail...>::call(head, tail...))
|
||||
template <typename ...Elements>
|
||||
deque(deque<Elements...>& seq)
|
||||
: base(seq)
|
||||
{}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
template <typename ...Elements>
|
||||
deque(deque<Elements...>&& seq)
|
||||
: base(std::forward<deque<Elements...>>(seq))
|
||||
{}
|
||||
#endif
|
||||
|
||||
deque(deque const& seq)
|
||||
: base(seq)
|
||||
{}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
deque(deque&& seq)
|
||||
: base(std::forward<deque>(seq))
|
||||
{}
|
||||
#endif
|
||||
|
||||
explicit deque(Head const& head, Tail const&... tail)
|
||||
: base(detail::deque_keyed_values<Head, Tail...>::construct(head, tail...))
|
||||
{}
|
||||
|
||||
template <typename Head_, typename ...Tail_>
|
||||
explicit deque(Head_ const& head, Tail_ const&... tail)
|
||||
: base(detail::deque_keyed_values<Head_, Tail_...>::construct(head, tail...))
|
||||
{}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
template <typename Head_, typename ...Tail_>
|
||||
explicit deque(Head_&& head, Tail_&&... tail)
|
||||
: base(detail::deque_keyed_values<Head, Tail...>
|
||||
::forward_(std::forward<Head_>(head), std::forward<Tail_>(tail)...))
|
||||
{}
|
||||
#endif
|
||||
|
||||
template <typename Sequence>
|
||||
explicit deque(Sequence const& seq
|
||||
, typename disable_if<is_convertible<Sequence, Head> >::type* /*dummy*/ = 0)
|
||||
@ -95,6 +146,16 @@ namespace boost { namespace fusion
|
||||
base::operator=(rhs);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
template <typename T>
|
||||
deque& operator=(T&& rhs)
|
||||
{
|
||||
base::operator=(std::forward<T>(rhs));
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
};
|
||||
}}
|
||||
|
||||
|
@ -16,10 +16,10 @@
|
||||
#if (defined(BOOST_NO_DECLTYPE) \
|
||||
|| defined(BOOST_NO_VARIADIC_TEMPLATES) \
|
||||
|| defined(BOOST_NO_RVALUE_REFERENCES))
|
||||
# include <boost/fusion/container/deque/detail/cpp03_deque_fwd.hpp>
|
||||
# include <boost/fusion/container/deque/detail/pp_deque_fwd.hpp>
|
||||
#else
|
||||
# if !defined(BOOST_FUSION_HAS_CPP11_DEQUE)
|
||||
# define BOOST_FUSION_HAS_CPP11_DEQUE
|
||||
# if !defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
|
||||
# define BOOST_FUSION_HAS_VARIADIC_DEQUE
|
||||
# endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -9,10 +9,12 @@
|
||||
#if !defined(BOOST_FUSION_SEQUENCE_DEQUE_DETAIL_DEQUE_FORWARD_CTOR_04122006_2212)
|
||||
#define BOOST_FUSION_SEQUENCE_DEQUE_DETAIL_DEQUE_FORWARD_CTOR_04122006_2212
|
||||
|
||||
#if defined(BOOST_FUSION_HAS_CPP11_DEQUE)
|
||||
#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
|
||||
#error "C++03 only! This file should not have been included"
|
||||
#endif
|
||||
|
||||
#define FUSION_DEQUE_FORWARD_CTOR_FORWARD(z, n, _) std::forward<T##n>(t##n)
|
||||
|
||||
#include <boost/preprocessor/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
@ -22,14 +24,22 @@
|
||||
#define BOOST_PP_ITERATION_LIMITS (2, FUSION_MAX_DEQUE_SIZE)
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#undef FUSION_DEQUE_FORWARD_CTOR_FORWARD
|
||||
#endif
|
||||
#else
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
deque(BOOST_PP_ENUM_BINARY_PARAMS(N, typename add_reference<typename add_const<T, >::type>::type t))
|
||||
: base(detail::deque_keyed_values<BOOST_PP_ENUM_PARAMS(N, T)>::call(BOOST_PP_ENUM_PARAMS(N, t)))
|
||||
: base(detail::deque_keyed_values<BOOST_PP_ENUM_PARAMS(N, T)>::construct(BOOST_PP_ENUM_PARAMS(N, t)))
|
||||
{}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
deque(BOOST_PP_ENUM_BINARY_PARAMS(N, T, && t))
|
||||
: base(detail::deque_keyed_values<BOOST_PP_ENUM_PARAMS(N, T)>::
|
||||
forward_(BOOST_PP_ENUM(N, FUSION_DEQUE_FORWARD_CTOR_FORWARD, _)))
|
||||
{}
|
||||
#endif
|
||||
|
||||
#undef N
|
||||
#endif
|
||||
|
@ -8,7 +8,7 @@
|
||||
#if !defined(BOOST_FUSION_DEQUE_DETAIL_DEQUE_INITIAL_SIZE_26112006_2139)
|
||||
#define BOOST_FUSION_DEQUE_DETAIL_DEQUE_INITIAL_SIZE_26112006_2139
|
||||
|
||||
#if defined(BOOST_FUSION_HAS_CPP11_DEQUE)
|
||||
#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
|
||||
#error "C++03 only! This file should not have been included"
|
||||
#endif
|
||||
|
||||
|
@ -9,25 +9,30 @@
|
||||
#if !defined(BOOST_FUSION_SEQUENCE_DEQUE_DETAIL_DEQUE_KEYED_VALUES_CALL_04122006_2211)
|
||||
#define BOOST_FUSION_SEQUENCE_DEQUE_DETAIL_DEQUE_KEYED_VALUES_CALL_04122006_2211
|
||||
|
||||
#if defined(BOOST_FUSION_HAS_CPP11_DEQUE)
|
||||
#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
|
||||
#error "C++03 only! This file should not have been included"
|
||||
#endif
|
||||
|
||||
#include <boost/preprocessor/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_shifted.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
|
||||
#define FUSION_DEQUE_KEYED_VALUES_FORWARD(z, n, _) \
|
||||
std::forward<BOOST_PP_CAT(T, n)>(BOOST_PP_CAT(t, n))
|
||||
|
||||
#define BOOST_PP_FILENAME_1 \
|
||||
<boost/fusion/container/deque/detail/deque_keyed_values_call.hpp>
|
||||
#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_DEQUE_SIZE)
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#undef FUSION_DEQUE_KEYED_VALUES_FORWARD
|
||||
#endif
|
||||
#else
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
static type call(BOOST_PP_ENUM_BINARY_PARAMS(N, typename add_reference<typename add_const<T, >::type>::type t))
|
||||
static type construct(BOOST_PP_ENUM_BINARY_PARAMS(N, typename add_reference<typename add_const<T, >::type>::type t))
|
||||
{
|
||||
return type(t0,
|
||||
deque_keyed_values_impl<
|
||||
@ -38,5 +43,16 @@
|
||||
>::call(BOOST_PP_ENUM_SHIFTED_PARAMS(N, t)));
|
||||
}
|
||||
|
||||
static type forward_(BOOST_PP_ENUM_BINARY_PARAMS(N, T, && t))
|
||||
{
|
||||
return type(std::forward<T0>(t0),
|
||||
deque_keyed_values_impl<
|
||||
next_index
|
||||
#if N > 1
|
||||
, BOOST_PP_ENUM_SHIFTED_PARAMS(N, T)
|
||||
#endif
|
||||
>::forward_(BOOST_PP_ENUM_SHIFTED(N, FUSION_DEQUE_KEYED_VALUES_FORWARD, _)));
|
||||
}
|
||||
|
||||
#undef N
|
||||
#endif
|
||||
|
@ -47,16 +47,42 @@ namespace boost { namespace fusion { namespace detail
|
||||
*it, base::from_iterator(fusion::next(it)));
|
||||
}
|
||||
|
||||
keyed_element(keyed_element const& rhs)
|
||||
: Rest(rhs.get_base()), value_(rhs.value_)
|
||||
{}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
keyed_element(keyed_element&& rhs)
|
||||
: Rest(std::forward<Rest>(rhs.forward_base()))
|
||||
, value_(std::forward<Value>(rhs.value_))
|
||||
{}
|
||||
#endif
|
||||
|
||||
template <typename U, typename Rst>
|
||||
keyed_element(keyed_element<Key, U, Rst> const& rhs)
|
||||
: Rest(rhs.get_base()), value_(rhs.value_)
|
||||
{}
|
||||
|
||||
Rest const get_base() const
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
#endif
|
||||
|
||||
Rest& get_base()
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
Rest const& get_base() const
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
Rest&& forward_base()
|
||||
{
|
||||
return std::forward<Rest>(*static_cast<Rest*>(this));
|
||||
}
|
||||
#endif
|
||||
|
||||
typename cref_result<Value>::type get(Key) const
|
||||
{
|
||||
return value_;
|
||||
@ -67,10 +93,19 @@ namespace boost { namespace fusion { namespace detail
|
||||
return value_;
|
||||
}
|
||||
|
||||
keyed_element(typename call_param<Value>::type value, Rest const& rest)
|
||||
keyed_element(
|
||||
typename detail::call_param<Value>::type value
|
||||
, Rest const& rest)
|
||||
: Rest(rest), value_(value)
|
||||
{}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
keyed_element(Value&& value, Rest&& rest)
|
||||
: Rest(std::forward<Rest>(rest))
|
||||
, value_(std::forward<Value>(value))
|
||||
{}
|
||||
#endif
|
||||
|
||||
keyed_element()
|
||||
: Rest(), value_()
|
||||
{}
|
||||
@ -90,6 +125,15 @@ namespace boost { namespace fusion { namespace detail
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
keyed_element& operator=(keyed_element&& rhs)
|
||||
{
|
||||
base::operator=(std::forward<keyed_element>(rhs));
|
||||
value_ = std::forward<Value>(rhs.value_);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
Value value_;
|
||||
};
|
||||
|
||||
|
@ -5,17 +5,17 @@
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_CPP03_FUSION_DEQUE_26112006_1649)
|
||||
#define BOOST_CPP03_FUSION_DEQUE_26112006_1649
|
||||
#if !defined(BOOST_PP_FUSION_DEQUE_26112006_1649)
|
||||
#define BOOST_PP_FUSION_DEQUE_26112006_1649
|
||||
|
||||
#if defined(BOOST_FUSION_HAS_CPP11_DEQUE)
|
||||
#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
|
||||
#error "C++03 only! This file should not have been included"
|
||||
#endif
|
||||
|
||||
#include <boost/fusion/container/deque/limits.hpp>
|
||||
#include <boost/fusion/container/deque/front_extended_deque.hpp>
|
||||
#include <boost/fusion/container/deque/back_extended_deque.hpp>
|
||||
#include <boost/fusion/container/deque/detail/cpp03_deque_keyed_values.hpp>
|
||||
#include <boost/fusion/container/deque/detail/pp_deque_keyed_values.hpp>
|
||||
#include <boost/fusion/container/deque/detail/deque_initial_size.hpp>
|
||||
#include <boost/fusion/support/sequence_base.hpp>
|
||||
#include <boost/fusion/container/deque/detail/keyed_element.hpp>
|
||||
@ -87,13 +87,34 @@ namespace boost { namespace fusion {
|
||||
: base(t0, detail::nil_keyed_element())
|
||||
{}
|
||||
|
||||
explicit deque(deque const& rhs)
|
||||
: base(rhs)
|
||||
{}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
explicit deque(T0&& t0)
|
||||
: base(std::forward<T0>(t0), detail::nil_keyed_element())
|
||||
{}
|
||||
|
||||
explicit deque(deque&& rhs)
|
||||
: base(std::forward<deque>(rhs))
|
||||
{}
|
||||
#endif
|
||||
|
||||
template<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, typename U)>
|
||||
deque(deque<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, U)> const& seq)
|
||||
deque(deque<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, U)> const& seq)
|
||||
: base(seq)
|
||||
{}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
template<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, typename U)>
|
||||
deque(deque<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, U)>&& seq)
|
||||
: base(std::forward<deque<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, U)>>(seq))
|
||||
{}
|
||||
#endif
|
||||
|
||||
template<typename Sequence>
|
||||
deque(Sequence const& seq, typename disable_if<is_convertible<Sequence, T0> >::type* /*dummy*/ = 0)
|
||||
deque(Sequence const& seq, typename disable_if<is_convertible<Sequence, T0> >::type* /*dummy*/ = 0)
|
||||
: base(base::from_iterator(fusion::begin(seq)))
|
||||
{}
|
||||
|
||||
@ -113,6 +134,16 @@ namespace boost { namespace fusion {
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
template <typename T>
|
||||
deque&
|
||||
operator=(T&& rhs)
|
||||
{
|
||||
base::operator=(std::forward<T>(rhs));
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
};
|
||||
}}
|
||||
|
@ -5,10 +5,10 @@
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_CPP03_DEQUE_FORWARD_02092007_0749)
|
||||
#define FUSION_CPP03_DEQUE_FORWARD_02092007_0749
|
||||
#if !defined(FUSION_PP_DEQUE_FORWARD_02092007_0749)
|
||||
#define FUSION_PP_DEQUE_FORWARD_02092007_0749
|
||||
|
||||
#if defined(BOOST_FUSION_HAS_CPP11_DEQUE)
|
||||
#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
|
||||
#error "C++03 only! This file should not have been included"
|
||||
#endif
|
||||
|
@ -8,7 +8,7 @@
|
||||
#if !defined(BOOST_FUSION_DEQUE_DETAIL_DEQUE_KEYED_VALUES_26112006_1330)
|
||||
#define BOOST_FUSION_DEQUE_DETAIL_DEQUE_KEYED_VALUES_26112006_1330
|
||||
|
||||
#if defined(BOOST_FUSION_HAS_CPP11_DEQUE)
|
||||
#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
|
||||
#error "C++03 only! This file should not have been included"
|
||||
#endif
|
||||
|
||||
@ -72,6 +72,11 @@ namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
return type();
|
||||
}
|
||||
|
||||
static type forward_()
|
||||
{
|
||||
return type();
|
||||
}
|
||||
};
|
||||
|
||||
template<typename N, BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, typename T)>
|
@ -28,13 +28,23 @@ namespace boost { namespace fusion { namespace detail
|
||||
typedef typename deque_keyed_values_impl<next_index, Tail...>::type tail;
|
||||
typedef keyed_element<N, Head, tail> type;
|
||||
|
||||
static type call(
|
||||
static type construct(
|
||||
typename detail::call_param<Head>::type head
|
||||
, typename detail::call_param<Tail>::type... tail)
|
||||
{
|
||||
return type(
|
||||
head
|
||||
, deque_keyed_values_impl<next_index, Tail...>::call(tail...)
|
||||
, deque_keyed_values_impl<next_index, Tail...>::construct(tail...)
|
||||
);
|
||||
}
|
||||
|
||||
template <typename Head_, typename ...Tail_>
|
||||
static type forward_(Head_&& head, Tail_&&... tail)
|
||||
{
|
||||
return type(
|
||||
std::forward<Head_>(head)
|
||||
, deque_keyed_values_impl<next_index, Tail_...>::
|
||||
forward_(std::forward<Tail_>(tail)...)
|
||||
);
|
||||
}
|
||||
};
|
||||
@ -45,7 +55,8 @@ namespace boost { namespace fusion { namespace detail
|
||||
struct deque_keyed_values_impl<N>
|
||||
{
|
||||
typedef nil_keyed_element type;
|
||||
static type call() { return type(); }
|
||||
static type construct() { return type(); }
|
||||
static type forward_() { return type(); }
|
||||
};
|
||||
|
||||
template <typename ...Elements>
|
@ -8,7 +8,7 @@
|
||||
#if !defined(BOOST_FUSION_DEQUE_LIMITS_26112006_1737)
|
||||
#define BOOST_FUSION_DEQUE_LIMITS_26112006_1737
|
||||
|
||||
#if defined(BOOST_FUSION_HAS_CPP11_DEQUE)
|
||||
#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
|
||||
#error "C++03 only! This file should not have been included"
|
||||
#endif
|
||||
|
||||
|
@ -12,11 +12,14 @@
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
|
||||
#define FUSION_FORWARD_CTOR_MOVE(z, n, _) std::move(_##n)
|
||||
|
||||
#define BOOST_PP_FILENAME_1 \
|
||||
<boost/fusion/container/vector/detail/vector_forward_ctor.hpp>
|
||||
#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_VECTOR_SIZE)
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#undef FUSION_FORWARD_CTOR_MOVE
|
||||
#endif
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -34,6 +37,14 @@
|
||||
N, typename detail::call_param<T, >::type _))
|
||||
: vec(BOOST_PP_ENUM_PARAMS(N, _)) {}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
#if N == 1
|
||||
explicit
|
||||
#endif
|
||||
vector(BOOST_PP_ENUM_BINARY_PARAMS(N, T, && _))
|
||||
: vec(BOOST_PP_ENUM(N, FUSION_FORWARD_CTOR_MOVE, _)) {}
|
||||
#endif
|
||||
|
||||
#undef N
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
|
@ -9,24 +9,31 @@
|
||||
#if !defined(FUSION_MACRO_05042005)
|
||||
#define FUSION_MACRO_05042005
|
||||
|
||||
#define FUSION_MEMBER_DEFAULT_INIT(z, n, _) m##n()
|
||||
#define FUSION_MEMBER_INIT(z, n, _) m##n(_##n)
|
||||
#define FUSION_COPY_INIT(z, n, _) m##n(other.m##n)
|
||||
#define FUSION_MEMBER_DECL(z, n, _) T##n m##n;
|
||||
#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_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_ARG_FWD(z, n, _) m##n(std::forward<T##n>(_##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_MEMBER_ASSIGN(z, n, _) \
|
||||
#define FUSION_VECTOR_MEMBER_MEMBER_ASSIGN(z, n, _) \
|
||||
this->BOOST_PP_CAT(m, n) = vec.BOOST_PP_CAT(m, n);
|
||||
|
||||
#define FUSION_DEREF_MEMBER_ASSIGN(z, n, _) \
|
||||
#define FUSION_VECTOR_MEMBER_DEREF_MEMBER_ASSIGN(z, n, _) \
|
||||
this->BOOST_PP_CAT(m, n) = *BOOST_PP_CAT(i, n);
|
||||
|
||||
#define FUSION_AT_IMPL(z, n, _) \
|
||||
#define FUSION_VECTOR_MEMBER_MEMBER_FORWARD(z, n, _) \
|
||||
this->BOOST_PP_CAT(m, n) = std::forward< \
|
||||
BOOST_PP_CAT(T, n)>(vec.BOOST_PP_CAT(m, n));
|
||||
|
||||
#define FUSION_VECTOR_MEMBER_AT_IMPL(z, n, _) \
|
||||
typename add_reference<T##n>::type \
|
||||
at_impl(mpl::int_<n>) { return this->m##n; } \
|
||||
typename add_reference<typename add_const<T##n>::type>::type \
|
||||
at_impl(mpl::int_<n>) const { return this->m##n; }
|
||||
|
||||
#define FUSION_ITER_DECL_VAR(z, n, _) \
|
||||
#define FUSION_VECTOR_MEMBER_ITER_DECL_VAR(z, n, _) \
|
||||
typedef typename result_of::next< \
|
||||
BOOST_PP_CAT(I, BOOST_PP_DEC(n))>::type BOOST_PP_CAT(I, n); \
|
||||
BOOST_PP_CAT(I, n) BOOST_PP_CAT(i, n) \
|
||||
@ -40,21 +47,32 @@
|
||||
struct BOOST_PP_CAT(vector_data, N)
|
||||
{
|
||||
BOOST_PP_CAT(vector_data, N)()
|
||||
: BOOST_PP_ENUM(N, FUSION_MEMBER_DEFAULT_INIT, _) {}
|
||||
: BOOST_PP_ENUM(N, FUSION_VECTOR_MEMBER_MEMBER_DEFAULT_INIT, _) {}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
BOOST_PP_CAT(vector_data, N)(BOOST_PP_ENUM_BINARY_PARAMS(N, T, && _))
|
||||
: 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<T, >::type _))
|
||||
: BOOST_PP_ENUM(N, FUSION_MEMBER_INIT, _) {}
|
||||
: BOOST_PP_ENUM(N, FUSION_VECTOR_MEMBER_MEMBER_INIT, _) {}
|
||||
|
||||
BOOST_PP_CAT(vector_data, N)(
|
||||
BOOST_PP_CAT(vector_data, N) const& other)
|
||||
: BOOST_PP_ENUM(N, FUSION_COPY_INIT, _) {}
|
||||
: BOOST_PP_ENUM(N, FUSION_VECTOR_MEMBER_COPY_INIT, _) {}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
BOOST_PP_CAT(vector_data, N)(
|
||||
BOOST_PP_CAT(vector_data, N)&& other)
|
||||
: BOOST_PP_ENUM(N, FUSION_VECTOR_MEMBER_FWD, _) {}
|
||||
#endif
|
||||
|
||||
BOOST_PP_CAT(vector_data, N)&
|
||||
operator=(BOOST_PP_CAT(vector_data, N) const& vec)
|
||||
{
|
||||
BOOST_PP_REPEAT(N, FUSION_MEMBER_ASSIGN, _)
|
||||
BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_MEMBER_ASSIGN, _)
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -64,7 +82,7 @@
|
||||
{
|
||||
typedef typename result_of::begin<Sequence const>::type I0;
|
||||
I0 i0 = fusion::begin(seq);
|
||||
BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_ITER_DECL_VAR, _)
|
||||
BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_VECTOR_MEMBER_ITER_DECL_VAR, _)
|
||||
return BOOST_PP_CAT(vector_data, N)(BOOST_PP_ENUM_PARAMS(N, *i));
|
||||
}
|
||||
|
||||
@ -74,11 +92,11 @@
|
||||
{
|
||||
typedef typename result_of::begin<Sequence>::type I0;
|
||||
I0 i0 = fusion::begin(seq);
|
||||
BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_ITER_DECL_VAR, _)
|
||||
BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_VECTOR_MEMBER_ITER_DECL_VAR, _)
|
||||
return BOOST_PP_CAT(vector_data, N)(BOOST_PP_ENUM_PARAMS(N, *i));
|
||||
}
|
||||
|
||||
BOOST_PP_REPEAT(N, FUSION_MEMBER_DECL, _)
|
||||
BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_MEMBER_DECL, _)
|
||||
};
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS(N, typename T)>
|
||||
@ -105,6 +123,19 @@
|
||||
N, typename detail::call_param<T, >::type _))
|
||||
: base_type(BOOST_PP_ENUM_PARAMS(N, _)) {}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
#if (N == 1)
|
||||
explicit
|
||||
#endif
|
||||
BOOST_PP_CAT(vector, N)(BOOST_PP_ENUM_BINARY_PARAMS(N, T, && _))
|
||||
: base_type(BOOST_PP_ENUM(N, FUSION_VECTOR_MEMBER_FORWARD, _)) {}
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
BOOST_PP_CAT(vector, N)(BOOST_PP_CAT(vector, N)&& rhs)
|
||||
: base_type(std::forward<base_type>(rhs)) {}
|
||||
#endif
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS(N, typename U)>
|
||||
BOOST_PP_CAT(vector, N)(
|
||||
BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM_PARAMS(N, U)> const& vec)
|
||||
@ -132,7 +163,7 @@
|
||||
BOOST_PP_CAT(vector, N)&
|
||||
operator=(BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM_PARAMS(N, U)> const& vec)
|
||||
{
|
||||
BOOST_PP_REPEAT(N, FUSION_MEMBER_ASSIGN, _)
|
||||
BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_MEMBER_ASSIGN, _)
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -142,12 +173,21 @@
|
||||
{
|
||||
typedef typename result_of::begin<Sequence const>::type I0;
|
||||
I0 i0 = fusion::begin(seq);
|
||||
BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_ITER_DECL_VAR, _)
|
||||
BOOST_PP_REPEAT(N, FUSION_DEREF_MEMBER_ASSIGN, _)
|
||||
BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_VECTOR_MEMBER_ITER_DECL_VAR, _)
|
||||
BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_DEREF_MEMBER_ASSIGN, _)
|
||||
return *this;
|
||||
}
|
||||
|
||||
BOOST_PP_REPEAT(N, FUSION_AT_IMPL, _)
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
BOOST_PP_CAT(vector, N)&
|
||||
operator=(BOOST_PP_CAT(vector, N)&& vec)
|
||||
{
|
||||
BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_MEMBER_FORWARD, _)
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_AT_IMPL, _)
|
||||
|
||||
template<typename I>
|
||||
typename add_reference<typename mpl::at<types, I>::type>::type
|
||||
@ -166,3 +206,4 @@
|
||||
|
||||
#undef N
|
||||
|
||||
|
||||
|
@ -106,6 +106,11 @@ namespace boost { namespace fusion
|
||||
vector(vector const& rhs)
|
||||
: vec(rhs.vec) {}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
vector(vector&& rhs)
|
||||
: vec(std::forward<vector_n>(rhs.vec)) {}
|
||||
#endif
|
||||
|
||||
template <typename Sequence>
|
||||
vector(Sequence const& rhs)
|
||||
: vec(BOOST_FUSION_VECTOR_COPY_INIT()) {}
|
||||
@ -135,6 +140,23 @@ namespace boost { namespace fusion
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
vector&
|
||||
operator=(vector&& rhs)
|
||||
{
|
||||
vec = std::forward<vector_n>(rhs.vec);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
vector&
|
||||
operator=(T&& rhs)
|
||||
{
|
||||
vec = std::forward<T>(rhs);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
template <int N>
|
||||
typename add_reference<
|
||||
typename mpl::at_c<types, N>::type
|
||||
|
Reference in New Issue
Block a user