forked from boostorg/fusion
added initial version of deque
[SVN r36457]
This commit is contained in:
@ -12,5 +12,6 @@
|
||||
#include <boost/fusion/sequence/container/list.hpp>
|
||||
#include <boost/fusion/sequence/container/map.hpp>
|
||||
#include <boost/fusion/sequence/container/set.hpp>
|
||||
#include <boost/fusion/sequence/container/deque.hpp>
|
||||
|
||||
#endif
|
||||
|
15
include/boost/fusion/sequence/container/deque.hpp
Normal file
15
include/boost/fusion/sequence/container/deque.hpp
Normal file
@ -0,0 +1,15 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is subject to 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_FUSION_SEQUENCE_CONTAINER_DEQUE_24112006_2036)
|
||||
#define BOOST_FUSION_SEQUENCE_CONTAINER_DEQUE_24112006_2036
|
||||
|
||||
#include <boost/fusion/sequence/container/deque/deque.hpp>
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,36 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is subject to 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_FUSION_BACK_EXTENDED_DEQUE_26112006_2209)
|
||||
#define BOOST_FUSION_BACK_EXTENDED_DEQUE_26112006_2209
|
||||
|
||||
#include <boost/fusion/sequence/container/deque/detail/keyed_element.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/mpl/plus.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/size.hpp>
|
||||
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
template<typename Deque, typename T>
|
||||
struct back_extended_deque
|
||||
: detail::keyed_element<typename Deque::next_up, T, Deque>
|
||||
{
|
||||
typedef detail::keyed_element<typename Deque::next_up, T, Deque> base;
|
||||
typedef typename Deque::next_down next_down;
|
||||
typedef mpl::int_<mpl::plus<typename Deque::next_up, mpl::int_<1> >::value> next_up;
|
||||
typedef mpl::plus<typename result_of::size<Deque>::type, mpl::int_<1> > size;
|
||||
|
||||
back_extended_deque(Deque const& deque, typename add_reference<typename add_const<T>::type>::type t)
|
||||
: base(t, deque)
|
||||
{}
|
||||
};
|
||||
}}
|
||||
|
||||
#endif
|
85
include/boost/fusion/sequence/container/deque/deque.hpp
Normal file
85
include/boost/fusion/sequence/container/deque/deque.hpp
Normal file
@ -0,0 +1,85 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is subject to 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_FUSION_DEQUE_26112006_1649)
|
||||
#define BOOST_FUSION_DEQUE_26112006_1649
|
||||
|
||||
#include <boost/fusion/sequence/container/deque/limits.hpp>
|
||||
#include <boost/fusion/sequence/container/deque/front_extended_deque.hpp>
|
||||
#include <boost/fusion/sequence/container/deque/back_extended_deque.hpp>
|
||||
#include <boost/fusion/sequence/container/deque/detail/deque_keyed_values.hpp>
|
||||
#include <boost/fusion/sequence/container/deque/detail/deque_initial_size.hpp>
|
||||
#include <boost/fusion/support/sequence_base.hpp>
|
||||
#include <boost/fusion/sequence/container/deque/detail/keyed_element.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/type_traits/add_reference.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
|
||||
#include <boost/fusion/sequence/container/deque/detail/value_at_impl.hpp>
|
||||
#include <boost/fusion/sequence/container/deque/detail/at_impl.hpp>
|
||||
#include <boost/fusion/sequence/container/deque/detail/begin_impl.hpp>
|
||||
#include <boost/fusion/sequence/container/deque/detail/end_impl.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct deque_tag;
|
||||
struct void_;
|
||||
|
||||
template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(FUSION_MAX_DEQUE_SIZE, typename T, void_)>
|
||||
struct deque;
|
||||
|
||||
template<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, typename T)>
|
||||
struct deque
|
||||
:
|
||||
detail::deque_keyed_values<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, T)>::type
|
||||
{
|
||||
typedef deque_tag fusion_tag;
|
||||
typedef typename detail::deque_keyed_values<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, T)>::type base;
|
||||
typedef typename detail::deque_initial_size<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, T)>::type size;
|
||||
typedef mpl::int_<size::value> next_up;
|
||||
typedef mpl::int_<
|
||||
mpl::if_<mpl::equal_to<size, mpl::int_<0> >, mpl::int_<0>, mpl::int_<-1> >::type::value> next_down;
|
||||
typedef mpl::false_ is_view;
|
||||
|
||||
#include <boost/fusion/sequence/container/deque/detail/deque_forward_ctor.hpp>
|
||||
|
||||
deque()
|
||||
{}
|
||||
|
||||
explicit deque(typename add_reference<typename add_const<T0>::type>::type t0)
|
||||
: base(t0, detail::nil_keyed_element())
|
||||
{}
|
||||
|
||||
template<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, typename U)>
|
||||
deque(deque<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, U)> const& seq)
|
||||
: base(seq)
|
||||
{}
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, typename U)>
|
||||
deque&
|
||||
operator=(deque<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, U)> const& rhs)
|
||||
{
|
||||
base::operator=(rhs);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
deque&
|
||||
operator=(T const& rhs)
|
||||
{
|
||||
base::operator=(rhs);
|
||||
return *this;
|
||||
}
|
||||
|
||||
};
|
||||
}}
|
||||
|
||||
#endif
|
107
include/boost/fusion/sequence/container/deque/deque_iterator.hpp
Normal file
107
include/boost/fusion/sequence/container/deque/deque_iterator.hpp
Normal file
@ -0,0 +1,107 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is subject to 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_FUSION_DEQUE_ITERATOR_26112006_2154)
|
||||
#define BOOST_FUSION_DEQUE_ITERATOR_26112006_2154
|
||||
|
||||
#include <boost/fusion/iterator/iterator_facade.hpp>
|
||||
#include <boost/fusion/sequence/container/deque/detail/keyed_element.hpp>
|
||||
#include <boost/mpl/minus.hpp>
|
||||
#include <boost/mpl/equal_to.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct bidirectional_traversal_tag;
|
||||
|
||||
template<typename Seq, int Pos>
|
||||
struct deque_iterator
|
||||
: iterator_facade<deque_iterator<Seq, Pos>, bidirectional_traversal_tag>
|
||||
{
|
||||
typedef Seq sequence;
|
||||
typedef mpl::int_<Pos> index;
|
||||
|
||||
deque_iterator(Seq& seq)
|
||||
: seq_(seq)
|
||||
{}
|
||||
|
||||
template<typename Iterator>
|
||||
struct value_of
|
||||
: detail::keyed_element_value_at<
|
||||
typename Iterator::sequence, typename Iterator::index>
|
||||
{};
|
||||
|
||||
template<typename Iterator>
|
||||
struct deref
|
||||
{
|
||||
typedef typename detail::keyed_element_value_at<
|
||||
typename Iterator::sequence, typename Iterator::index>::type element_type;
|
||||
|
||||
typedef typename add_reference<
|
||||
typename mpl::eval_if<
|
||||
is_const<typename Iterator::sequence>,
|
||||
add_const<element_type>,
|
||||
mpl::identity<element_type> >::type>::type type;
|
||||
|
||||
static type
|
||||
call(Iterator const& it)
|
||||
{
|
||||
return it.seq_.get(typename Iterator::index());
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Iterator, typename N>
|
||||
struct advance
|
||||
{
|
||||
typedef typename Iterator::index index;
|
||||
typedef typename Iterator::sequence sequence;
|
||||
typedef deque_iterator<sequence, index::value + N::value> type;
|
||||
|
||||
static type
|
||||
call(Iterator const& i)
|
||||
{
|
||||
return type(i.seq_);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Iterator>
|
||||
struct next
|
||||
: advance<Iterator, mpl::int_<1> >
|
||||
{};
|
||||
|
||||
template<typename Iterator>
|
||||
struct prior
|
||||
: advance<Iterator, mpl::int_<-1> >
|
||||
{};
|
||||
|
||||
template <typename I1, typename I2>
|
||||
struct distance : mpl::minus<typename I2::index, typename I1::index>
|
||||
{
|
||||
typedef typename
|
||||
mpl::minus<
|
||||
typename I2::index, typename I1::index
|
||||
>::type
|
||||
type;
|
||||
|
||||
static type
|
||||
call(I1 const&, I2 const&)
|
||||
{
|
||||
return type();
|
||||
}
|
||||
};
|
||||
|
||||
template<typename I1, typename I2>
|
||||
struct equal_to
|
||||
: mpl::equal_to<typename I1::index, typename I2::index>
|
||||
{};
|
||||
|
||||
Seq& seq_;
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,60 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is subject to 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_FUSION_DEQUE_AT_IMPL_09122006_2017)
|
||||
#define BOOST_FUSION_DEQUE_AT_IMPL_09122006_2017
|
||||
|
||||
#include <boost/fusion/sequence/container/deque/detail/keyed_element.hpp>
|
||||
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/equal_to.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct deque_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename T>
|
||||
struct at_impl;
|
||||
|
||||
template<>
|
||||
struct at_impl<deque_tag>
|
||||
{
|
||||
template<typename Sequence, typename N>
|
||||
struct apply
|
||||
{
|
||||
typedef typename Sequence::next_up next_up;
|
||||
typedef typename Sequence::next_down next_down;
|
||||
BOOST_MPL_ASSERT_RELATION(next_down::value, !=, next_up::value);
|
||||
|
||||
typedef mpl::plus<next_down, mpl::int_<1> > offset;
|
||||
typedef mpl::int_<mpl::plus<N, offset>::value> adjusted_index;
|
||||
typedef typename detail::keyed_element_value_at<Sequence, adjusted_index>::type element_type;
|
||||
typedef typename add_reference<
|
||||
typename mpl::eval_if<
|
||||
is_const<Sequence>,
|
||||
add_const<element_type>,
|
||||
mpl::identity<element_type> >::type>::type type;
|
||||
|
||||
static type call(Sequence& seq)
|
||||
{
|
||||
return seq.get(adjusted_index());
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,47 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is subject to 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_FUSION_DEQUE_BEGIN_IMPL_09122006_2034)
|
||||
#define BOOST_FUSION_DEQUE_BEGIN_IMPL_09122006_2034
|
||||
|
||||
#include <boost/fusion/sequence/container/deque/deque_iterator.hpp>
|
||||
|
||||
#include <boost/mpl/equal_to.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct deque_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename T>
|
||||
struct begin_impl;
|
||||
|
||||
template<>
|
||||
struct begin_impl<deque_tag>
|
||||
{
|
||||
template<typename Sequence>
|
||||
struct apply
|
||||
{
|
||||
typedef typename mpl::if_<
|
||||
mpl::equal_to<typename Sequence::next_down, typename Sequence::next_up>,
|
||||
deque_iterator<Sequence, 0>,
|
||||
deque_iterator<
|
||||
Sequence, mpl::plus<typename Sequence::next_down, mpl::int_<1> >::value> >::type type;
|
||||
|
||||
static type call(Sequence& seq)
|
||||
{
|
||||
return type(seq);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,32 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is subject to 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_PP_IS_ITERATING)
|
||||
#if !defined(BOOST_FUSION_SEQUENCE_DEQUE_DETAIL_DEQUE_FORWARD_CTOR_04122006_2212)
|
||||
#define BOOST_FUSION_SEQUENCE_DEQUE_DETAIL_DEQUE_FORWARD_CTOR_04122006_2212
|
||||
|
||||
#include <boost/preprocessor/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
|
||||
#define BOOST_PP_FILENAME_1 \
|
||||
<boost/fusion/sequence/container/deque/detail/deque_forward_ctor.hpp>
|
||||
#define BOOST_PP_ITERATION_LIMITS (2, FUSION_MAX_DEQUE_SIZE)
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#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)))
|
||||
{}
|
||||
|
||||
#undef N
|
||||
#endif
|
@ -0,0 +1,34 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is subject to 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_FUSION_DEQUE_DETAIL_DEQUE_INITIAL_SIZE_26112006_2139)
|
||||
#define BOOST_FUSION_DEQUE_DETAIL_DEQUE_INITIAL_SIZE_26112006_2139
|
||||
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/mpl/find.hpp>
|
||||
#include <boost/mpl/begin.hpp>
|
||||
#include <boost/mpl/distance.hpp>
|
||||
#include <boost/mpl/equal_to.hpp>
|
||||
#include <boost/mpl/vector.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct void_;
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, typename T)>
|
||||
struct deque_initial_size
|
||||
{
|
||||
typedef mpl::vector<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, T)> args;
|
||||
typedef typename mpl::find<args, void_>::type first_void;
|
||||
typedef typename mpl::distance<typename mpl::begin<args>::type, first_void>::type type;
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
@ -0,0 +1,76 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is subject to 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_FUSION_DEQUE_DETAIL_DEQUE_KEYED_VALUES_26112006_1330)
|
||||
#define BOOST_FUSION_DEQUE_DETAIL_DEQUE_KEYED_VALUES_26112006_1330
|
||||
|
||||
#include <boost/fusion/sequence/container/deque/limits.hpp>
|
||||
#include <boost/fusion/sequence/container/deque/detail/keyed_element.hpp>
|
||||
|
||||
#include <boost/preprocessor/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
|
||||
#include <boost/mpl/plus.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/mpl/print.hpp>
|
||||
|
||||
#define FUSION_VOID(z, n, _) void_
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct void_;
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<typename Key, typename Value, typename Rest>
|
||||
struct keyed_element;
|
||||
|
||||
struct nil_keyed_element;
|
||||
|
||||
template<typename N, BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(FUSION_MAX_DEQUE_SIZE, typename T, void_)>
|
||||
struct deque_keyed_values_impl;
|
||||
|
||||
template<typename N>
|
||||
struct deque_keyed_values_impl<N, BOOST_PP_ENUM(FUSION_MAX_DEQUE_SIZE, FUSION_VOID, _)>
|
||||
{
|
||||
typedef nil_keyed_element type;
|
||||
|
||||
static type call()
|
||||
{
|
||||
return type();
|
||||
}
|
||||
};
|
||||
|
||||
template<typename N, BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, typename T)>
|
||||
struct deque_keyed_values_impl
|
||||
{
|
||||
typedef mpl::int_<mpl::plus<N, mpl::int_<1> >::value> next_index;
|
||||
|
||||
typedef typename deque_keyed_values_impl<
|
||||
next_index,
|
||||
BOOST_PP_ENUM_SHIFTED_PARAMS(FUSION_MAX_DEQUE_SIZE, T)>::type tail;
|
||||
typedef keyed_element<N, T0, tail> type;
|
||||
|
||||
#include <boost/fusion/sequence/container/deque/detail/deque_keyed_values_call.hpp>
|
||||
|
||||
};
|
||||
|
||||
template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(FUSION_MAX_DEQUE_SIZE, typename T, void_)>
|
||||
struct deque_keyed_values
|
||||
: deque_keyed_values_impl<mpl::int_<0>, BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, T)>
|
||||
{};
|
||||
|
||||
}}}
|
||||
|
||||
#undef FUSION_VOID
|
||||
|
||||
#endif
|
@ -0,0 +1,39 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is subject to 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_PP_IS_ITERATING)
|
||||
#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
|
||||
|
||||
#include <boost/preprocessor/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
|
||||
#define BOOST_PP_FILENAME_1 \
|
||||
<boost/fusion/sequence/container/deque/detail/deque_keyed_values_call.hpp>
|
||||
#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_DEQUE_SIZE)
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#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))
|
||||
{
|
||||
return type(t0,
|
||||
deque_keyed_values_impl<
|
||||
next_index
|
||||
#if N > 1
|
||||
, BOOST_PP_ENUM_SHIFTED_PARAMS(N, T)
|
||||
#endif
|
||||
>::call(BOOST_PP_ENUM_SHIFTED_PARAMS(N, t)));
|
||||
}
|
||||
|
||||
#undef N
|
||||
#endif
|
@ -0,0 +1,47 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is subject to 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_FUSION_DEQUE_END_IMPL_09122006_2034)
|
||||
#define BOOST_FUSION_DEQUE_END_IMPL_09122006_2034
|
||||
|
||||
#include <boost/fusion/sequence/container/deque/deque_iterator.hpp>
|
||||
|
||||
#include <boost/mpl/equal_to.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct deque_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename T>
|
||||
struct end_impl;
|
||||
|
||||
template<>
|
||||
struct end_impl<deque_tag>
|
||||
{
|
||||
template<typename Sequence>
|
||||
struct apply
|
||||
{
|
||||
typedef typename mpl::if_<
|
||||
mpl::equal_to<typename Sequence::next_down, typename Sequence::next_up>,
|
||||
deque_iterator<Sequence, 0>,
|
||||
deque_iterator<
|
||||
Sequence, Sequence::next_up::value> >::type type;
|
||||
|
||||
static type call(Sequence& seq)
|
||||
{
|
||||
return type(seq);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,96 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is subject to 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_FUSION_DEQUE_DETAIL_KEYED_ELEMENT_26112006_1330)
|
||||
#define BOOST_FUSION_DEQUE_DETAIL_KEYED_ELEMENT_26112006_1330
|
||||
|
||||
#include <boost/fusion/support/sequence_base.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct fusion_sequence_tag;
|
||||
|
||||
namespace detail {
|
||||
|
||||
struct nil_keyed_element
|
||||
: sequence_base<nil_keyed_element>
|
||||
{
|
||||
typedef fusion_sequence_tag tag;
|
||||
void get();
|
||||
};
|
||||
|
||||
template<typename Key, typename Value, typename Rest>
|
||||
struct keyed_element
|
||||
: Rest
|
||||
{
|
||||
typedef Rest base;
|
||||
typedef fusion_sequence_tag tag;
|
||||
using Rest::get;
|
||||
|
||||
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
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
typename add_reference<typename add_const<Value>::type>::type get(Key) const
|
||||
{
|
||||
return value_;
|
||||
}
|
||||
|
||||
typename add_reference<Value>::type get(Key)
|
||||
{
|
||||
return value_;
|
||||
}
|
||||
|
||||
keyed_element(typename add_reference<typename add_const<Value>::type>::type value, Rest const& rest)
|
||||
: Rest(rest), value_(value)
|
||||
{}
|
||||
|
||||
keyed_element()
|
||||
: Rest(), value_()
|
||||
{}
|
||||
|
||||
template<typename U, typename Rst>
|
||||
keyed_element& operator=(keyed_element<Key, U, Rst> const& rhs)
|
||||
{
|
||||
base::operator=(static_cast<Rst const&>(rhs)); // cast for msvc-7.1
|
||||
value_ = rhs.value_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
keyed_element& operator=(keyed_element const& rhs)
|
||||
{
|
||||
base::operator=(rhs);
|
||||
value_ = rhs.value_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Value value_;
|
||||
};
|
||||
|
||||
template<typename Elem, typename Key>
|
||||
struct keyed_element_value_at
|
||||
: keyed_element_value_at<typename Elem::base, Key>
|
||||
{};
|
||||
|
||||
template<typename Key, typename Value, typename Rest>
|
||||
struct keyed_element_value_at<keyed_element<Key, Value, Rest>, Key>
|
||||
{
|
||||
typedef Value type;
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
#endif
|
@ -0,0 +1,44 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is subject to 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_FUSION_DEQUE_VALUE_AT_IMPL_08122006_0756)
|
||||
#define BOOST_FUSION_DEQUE_VALUE_AT_IMPL_08122006_0756
|
||||
|
||||
#include <boost/fusion/sequence/container/deque/detail/keyed_element.hpp>
|
||||
|
||||
#include <boost/mpl/equal_to.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct deque_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename T>
|
||||
struct value_at_impl;
|
||||
|
||||
template<>
|
||||
struct value_at_impl<deque_tag>
|
||||
{
|
||||
template<typename Sequence, typename N>
|
||||
struct apply
|
||||
{
|
||||
typedef typename Sequence::next_up next_up;
|
||||
typedef typename Sequence::next_down next_down;
|
||||
BOOST_MPL_ASSERT_RELATION(next_down::value, !=, next_up::value);
|
||||
|
||||
typedef mpl::plus<next_down, mpl::int_<1> > offset;
|
||||
typedef mpl::int_<mpl::plus<N, offset>::value> adjusted_index;
|
||||
typedef typename detail::keyed_element_value_at<Sequence, adjusted_index>::type type;
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,37 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is subject to 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_FUSION_FRONT_EXTENDED_DEQUE_26112006_2209)
|
||||
#define BOOST_FUSION_FRONT_EXTENDED_DEQUE_26112006_2209
|
||||
|
||||
#include <boost/fusion/sequence/container/deque/detail/keyed_element.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/mpl/minus.hpp>
|
||||
#include <boost/mpl/plus.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/size.hpp>
|
||||
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
template<typename Deque, typename T>
|
||||
struct front_extended_deque
|
||||
: detail::keyed_element<typename Deque::next_down, T, Deque>
|
||||
{
|
||||
typedef detail::keyed_element<typename Deque::next_down, T, Deque> base;
|
||||
typedef mpl::int_<mpl::minus<typename Deque::next_down, mpl::int_<1> >::value> next_down;
|
||||
typedef typename Deque::next_up next_up;
|
||||
typedef mpl::plus<typename result_of::size<Deque>::type, mpl::int_<1> > size;
|
||||
|
||||
front_extended_deque(Deque const& deque, typename add_reference<typename add_const<T>::type>::type t)
|
||||
: base(t, deque)
|
||||
{}
|
||||
};
|
||||
}}
|
||||
|
||||
#endif
|
16
include/boost/fusion/sequence/container/deque/limits.hpp
Normal file
16
include/boost/fusion/sequence/container/deque/limits.hpp
Normal file
@ -0,0 +1,16 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is subject to 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_FUSION_DEQUE_LIMITS_26112006_1737)
|
||||
#define BOOST_FUSION_DEQUE_LIMITS_26112006_1737
|
||||
|
||||
#if !defined(FUSION_MAX_DEQUE_SIZE)
|
||||
#define FUSION_MAX_DEQUE_SIZE 10
|
||||
#endif
|
||||
|
||||
#endif
|
@ -12,5 +12,6 @@
|
||||
#include <boost/fusion/sequence/conversion/as_map.hpp>
|
||||
#include <boost/fusion/sequence/conversion/as_set.hpp>
|
||||
#include <boost/fusion/sequence/conversion/as_vector.hpp>
|
||||
#include <boost/fusion/sequence/conversion/as_deque.hpp>
|
||||
|
||||
#endif
|
||||
|
48
include/boost/fusion/sequence/conversion/as_deque.hpp
Normal file
48
include/boost/fusion/sequence/conversion/as_deque.hpp
Normal file
@ -0,0 +1,48 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is subject to 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_AS_DEQUE_20061213_2207)
|
||||
#define FUSION_AS_DEQUE_20061213_2207
|
||||
|
||||
#include <boost/fusion/sequence/conversion/detail/as_deque.hpp>
|
||||
#include <boost/fusion/sequence/container/deque/deque.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/size.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct as_deque
|
||||
{
|
||||
typedef typename detail::as_deque<result_of::size<Sequence>::value> gen;
|
||||
typedef typename gen::
|
||||
template apply<typename result_of::begin<Sequence>::type>::type
|
||||
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));
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
103
include/boost/fusion/sequence/conversion/detail/as_deque.hpp
Normal file
103
include/boost/fusion/sequence/conversion/detail/as_deque.hpp
Normal file
@ -0,0 +1,103 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is subject to 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_AS_DEQUE_20061213_2210)
|
||||
#define FUSION_AS_DEQUE_20061213_2210
|
||||
|
||||
#include <boost/preprocessor/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/inc.hpp>
|
||||
#include <boost/preprocessor/dec.hpp>
|
||||
#include <boost/fusion/sequence/container/deque/deque.hpp>
|
||||
#include <boost/fusion/iterator/value_of.hpp>
|
||||
#include <boost/fusion/iterator/deref.hpp>
|
||||
#include <boost/fusion/iterator/next.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
template <int size>
|
||||
struct as_deque;
|
||||
|
||||
template <>
|
||||
struct as_deque<0>
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct apply
|
||||
{
|
||||
typedef deque<> type;
|
||||
};
|
||||
|
||||
template <typename Iterator>
|
||||
static typename apply<Iterator>::type
|
||||
call(Iterator)
|
||||
{
|
||||
return deque<>();
|
||||
}
|
||||
};
|
||||
|
||||
#define BOOST_FUSION_NEXT_ITERATOR(z, n, data) \
|
||||
typedef typename fusion::result_of::next<BOOST_PP_CAT(I, n)>::type \
|
||||
BOOST_PP_CAT(I, BOOST_PP_INC(n));
|
||||
|
||||
#define BOOST_FUSION_NEXT_CALL_ITERATOR(z, n, data) \
|
||||
typename gen::BOOST_PP_CAT(I, BOOST_PP_INC(n)) \
|
||||
BOOST_PP_CAT(i, BOOST_PP_INC(n)) = fusion::next(BOOST_PP_CAT(i, n));
|
||||
|
||||
#define BOOST_FUSION_VALUE_OF_ITERATOR(z, n, data) \
|
||||
typedef typename fusion::result_of::value_of<BOOST_PP_CAT(I, n)>::type \
|
||||
BOOST_PP_CAT(T, n);
|
||||
|
||||
#define BOOST_PP_FILENAME_1 <boost/fusion/sequence/conversion/detail/as_deque.hpp>
|
||||
#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_DEQUE_SIZE)
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#undef BOOST_FUSION_NEXT_ITERATOR
|
||||
#undef BOOST_FUSION_NEXT_CALL_ITERATOR
|
||||
#undef BOOST_FUSION_VALUE_OF_ITERATOR
|
||||
|
||||
}}}
|
||||
|
||||
#endif
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Preprocessor vertical repetition code
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
template <>
|
||||
struct as_deque<N>
|
||||
{
|
||||
template <typename I0>
|
||||
struct apply
|
||||
{
|
||||
BOOST_PP_REPEAT(N, BOOST_FUSION_NEXT_ITERATOR, _)
|
||||
BOOST_PP_REPEAT(N, BOOST_FUSION_VALUE_OF_ITERATOR, _)
|
||||
typedef deque<BOOST_PP_ENUM_PARAMS(N, T)> type;
|
||||
};
|
||||
|
||||
template <typename Iterator>
|
||||
static typename apply<Iterator>::type
|
||||
call(Iterator const& i0)
|
||||
{
|
||||
typedef apply<Iterator> gen;
|
||||
typedef typename gen::type result;
|
||||
BOOST_PP_REPEAT(BOOST_PP_DEC(N), BOOST_FUSION_NEXT_CALL_ITERATOR, _)
|
||||
return result(BOOST_PP_ENUM_PARAMS(N, *i));
|
||||
}
|
||||
};
|
||||
|
||||
#undef N
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
|
73
include/boost/fusion/sequence/generation/deque_tie.hpp
Normal file
73
include/boost/fusion/sequence/generation/deque_tie.hpp
Normal file
@ -0,0 +1,73 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is subject to 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/fusion/sequence/container/deque/deque.hpp>
|
||||
|
||||
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/sequence/generation/deque_tie.hpp>
|
||||
#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_DEQUE_SIZE)
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#undef BOOST_FUSION_REF
|
||||
|
||||
}}
|
||||
|
||||
#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)>
|
||||
struct deque_tie<BOOST_PP_ENUM_PARAMS(N, T)>
|
||||
{
|
||||
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)
|
||||
|
93
include/boost/fusion/sequence/generation/make_deque.hpp
Normal file
93
include/boost/fusion/sequence/generation/make_deque.hpp
Normal file
@ -0,0 +1,93 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is subject to 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-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is subject to 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/fusion/sequence/container/deque/deque.hpp>
|
||||
#include <boost/fusion/support/detail/as_fusion_element.hpp>
|
||||
|
||||
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/sequence/generation/make_deque.hpp>
|
||||
#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_DEQUE_SIZE)
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#undef BOOST_FUSION_AS_FUSION_ELEMENT
|
||||
|
||||
}}
|
||||
|
||||
#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)>
|
||||
struct make_deque<BOOST_PP_ENUM_PARAMS(N, T)>
|
||||
{
|
||||
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)
|
||||
|
@ -43,6 +43,13 @@ namespace boost { namespace fusion { namespace detail
|
||||
struct apply : result_of::as_vector<Sequence> {};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct as_impl<deque_tag>
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply : result_of::as_deque<Sequence> {};
|
||||
};
|
||||
|
||||
template <typename Tag, typename Sequence>
|
||||
struct as
|
||||
{
|
||||
|
Reference in New Issue
Block a user