PageRenderTime 11ms CodeModel.GetById 1ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/fusion/container/deque/deque.hpp

http://hadesmem.googlecode.com/
C++ Header | 95 lines | 73 code | 15 blank | 7 comment | 0 complexity | 7603171c0e8c01cbc3843fb32183f4ea MD5 | raw file
 1/*=============================================================================
 2    Copyright (c) 2001-2006 Joel de Guzman
 3    Copyright (c) 2005-2006 Dan Marsden
 4
 5    Distributed under the Boost Software License, Version 1.0. (See accompanying 
 6    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 7==============================================================================*/
 8#if !defined(BOOST_FUSION_DEQUE_26112006_1649)
 9#define BOOST_FUSION_DEQUE_26112006_1649
10
11#include <boost/fusion/container/deque/limits.hpp>
12#include <boost/fusion/container/deque/front_extended_deque.hpp>
13#include <boost/fusion/container/deque/back_extended_deque.hpp>
14#include <boost/fusion/container/deque/detail/deque_keyed_values.hpp>
15#include <boost/fusion/container/deque/detail/deque_initial_size.hpp>
16#include <boost/fusion/support/sequence_base.hpp>
17#include <boost/fusion/container/deque/detail/keyed_element.hpp>
18#include <boost/preprocessor/repetition/enum_params.hpp>
19#include <boost/preprocessor/repetition/enum_binary_params.hpp>
20#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
21#include <boost/type_traits/add_reference.hpp>
22#include <boost/type_traits/add_const.hpp>
23#include <boost/type_traits/is_convertible.hpp>
24
25#include <boost/fusion/container/deque/deque_fwd.hpp>
26#include <boost/fusion/container/deque/detail/value_at_impl.hpp>
27#include <boost/fusion/container/deque/detail/at_impl.hpp>
28#include <boost/fusion/container/deque/detail/begin_impl.hpp>
29#include <boost/fusion/container/deque/detail/end_impl.hpp>
30#include <boost/fusion/container/deque/detail/is_sequence_impl.hpp>
31#include <boost/fusion/sequence/intrinsic/begin.hpp>
32#include <boost/mpl/bool.hpp>
33
34#include <boost/fusion/support/sequence_base.hpp>
35#include <boost/fusion/support/void.hpp>
36#include <boost/utility/enable_if.hpp>
37
38namespace boost { namespace fusion {
39
40    struct deque_tag;
41
42    template<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, typename T)>
43    struct deque
44        :
45        detail::deque_keyed_values<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, T)>::type,
46        sequence_base<deque<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, T)> >
47    {
48        typedef deque_tag fusion_tag;
49        typedef bidirectional_traversal_tag category;
50        typedef typename detail::deque_keyed_values<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, T)>::type base;
51        typedef typename detail::deque_initial_size<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, T)>::type size;
52        typedef mpl::int_<size::value> next_up;
53        typedef mpl::int_<
54            mpl::if_<mpl::equal_to<size, mpl::int_<0> >, mpl::int_<0>, mpl::int_<-1> >::type::value> next_down;
55        typedef mpl::false_ is_view;
56
57#include <boost/fusion/container/deque/detail/deque_forward_ctor.hpp>
58
59        deque()
60            {}
61
62        explicit deque(typename add_reference<typename add_const<T0>::type>::type t0)
63            : base(t0, detail::nil_keyed_element())
64            {}
65
66        template<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, typename U)>
67            deque(deque<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, U)> const& seq)
68            : base(seq)
69            {}
70
71        template<typename Sequence>
72            deque(Sequence const& seq, typename disable_if<is_convertible<Sequence, T0> >::type* /*dummy*/ = 0)
73            : base(base::from_iterator(fusion::begin(seq)))
74            {}
75
76        template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, typename U)>
77        deque&
78        operator=(deque<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, U)> const& rhs)
79        {
80            base::operator=(rhs);
81            return *this;
82        }
83
84        template <typename T>
85        deque&
86        operator=(T const& rhs)
87        {
88            base::operator=(rhs);
89            return *this;
90        }
91
92    };
93}}
94
95#endif