Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/fusion/container/deque/deque.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children | c530137014c0 |
comparison
equal
deleted
inserted
replaced
15:663ca0da4350 | 16:2665513ce2d3 |
---|---|
1 /*============================================================================= | |
2 Copyright (c) 2005-2012 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/deque_fwd.hpp> | |
12 | |
13 /////////////////////////////////////////////////////////////////////////////// | |
14 // Without variadics, we will use the PP version | |
15 /////////////////////////////////////////////////////////////////////////////// | |
16 #if !defined(BOOST_FUSION_HAS_VARIADIC_DEQUE) | |
17 # include <boost/fusion/container/deque/detail/cpp03/deque.hpp> | |
18 #else | |
19 | |
20 /////////////////////////////////////////////////////////////////////////////// | |
21 // C++11 interface | |
22 /////////////////////////////////////////////////////////////////////////////// | |
23 #include <boost/fusion/support/sequence_base.hpp> | |
24 #include <boost/fusion/support/detail/access.hpp> | |
25 #include <boost/fusion/support/is_sequence.hpp> | |
26 #include <boost/fusion/container/deque/detail/keyed_element.hpp> | |
27 #include <boost/fusion/container/deque/detail/deque_keyed_values.hpp> | |
28 #include <boost/fusion/container/deque/deque_fwd.hpp> | |
29 #include <boost/fusion/container/deque/detail/value_at_impl.hpp> | |
30 #include <boost/fusion/container/deque/detail/at_impl.hpp> | |
31 #include <boost/fusion/container/deque/detail/begin_impl.hpp> | |
32 #include <boost/fusion/container/deque/detail/end_impl.hpp> | |
33 #include <boost/fusion/container/deque/detail/is_sequence_impl.hpp> | |
34 #include <boost/fusion/sequence/intrinsic/begin.hpp> | |
35 #include <boost/fusion/sequence/intrinsic/empty.hpp> | |
36 | |
37 #include <boost/mpl/int.hpp> | |
38 #include <boost/mpl/and.hpp> | |
39 #include <boost/utility/enable_if.hpp> | |
40 #include <boost/type_traits/is_convertible.hpp> | |
41 | |
42 namespace boost { namespace fusion | |
43 { | |
44 struct deque_tag; | |
45 | |
46 template <typename ...Elements> | |
47 struct deque : detail::nil_keyed_element | |
48 { | |
49 typedef deque_tag fusion_tag; | |
50 typedef bidirectional_traversal_tag category; | |
51 typedef mpl::int_<0> size; | |
52 typedef mpl::int_<0> next_up; | |
53 typedef mpl::int_<0> next_down; | |
54 typedef mpl::false_ is_view; | |
55 | |
56 template <typename Sequence> | |
57 deque(Sequence const&, | |
58 typename enable_if< | |
59 mpl::and_< | |
60 traits::is_sequence<Sequence> | |
61 , result_of::empty<Sequence>>>::type* /*dummy*/ = 0) | |
62 {} | |
63 | |
64 deque() {} | |
65 }; | |
66 | |
67 template <typename Head, typename ...Tail> | |
68 struct deque<Head, Tail...> | |
69 : detail::deque_keyed_values<Head, Tail...>::type | |
70 , sequence_base<deque<Head, Tail...>> | |
71 { | |
72 typedef deque_tag fusion_tag; | |
73 typedef bidirectional_traversal_tag category; | |
74 typedef typename detail::deque_keyed_values<Head, Tail...>::type base; | |
75 typedef mpl::int_<(sizeof ...(Tail) + 1)> size; | |
76 typedef mpl::int_<size::value> next_up; | |
77 typedef mpl::int_<((size::value == 0) ? 0 : -1)> next_down; | |
78 typedef mpl::false_ is_view; | |
79 | |
80 deque() | |
81 {} | |
82 | |
83 template <typename ...Elements> | |
84 deque(deque<Elements...> const& seq) | |
85 : base(seq) | |
86 {} | |
87 | |
88 template <typename ...Elements> | |
89 deque(deque<Elements...>& seq) | |
90 : base(seq) | |
91 {} | |
92 | |
93 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) | |
94 template <typename ...Elements> | |
95 deque(deque<Elements...>&& seq) | |
96 : base(std::forward<deque<Elements...>>(seq)) | |
97 {} | |
98 #endif | |
99 | |
100 deque(deque const& seq) | |
101 : base(seq) | |
102 {} | |
103 | |
104 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) | |
105 deque(deque&& seq) | |
106 : base(std::forward<deque>(seq)) | |
107 {} | |
108 #endif | |
109 | |
110 explicit deque(Head const& head, Tail const&... tail) | |
111 : base(detail::deque_keyed_values<Head, Tail...>::construct(head, tail...)) | |
112 {} | |
113 | |
114 template <typename Head_, typename ...Tail_> | |
115 explicit deque(Head_ const& head, Tail_ const&... tail) | |
116 : base(detail::deque_keyed_values<Head_, Tail_...>::construct(head, tail...)) | |
117 {} | |
118 | |
119 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) | |
120 template <typename Head_, typename ...Tail_> | |
121 explicit deque(Head_&& head, Tail_&&... tail) | |
122 : base(detail::deque_keyed_values<Head, Tail...> | |
123 ::forward_(std::forward<Head_>(head), std::forward<Tail_>(tail)...)) | |
124 {} | |
125 #endif | |
126 | |
127 template <typename Sequence> | |
128 explicit deque(Sequence const& seq | |
129 , typename disable_if<is_convertible<Sequence, Head> >::type* /*dummy*/ = 0) | |
130 : base(base::from_iterator(fusion::begin(seq))) | |
131 {} | |
132 | |
133 template <typename ...Elements> | |
134 deque& operator=(deque<Elements...> const& rhs) | |
135 { | |
136 base::operator=(rhs); | |
137 return *this; | |
138 } | |
139 | |
140 template <typename T> | |
141 deque& operator=(T const& rhs) | |
142 { | |
143 base::operator=(rhs); | |
144 return *this; | |
145 } | |
146 | |
147 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) | |
148 template <typename T> | |
149 deque& operator=(T&& rhs) | |
150 { | |
151 base::operator=(std::forward<T>(rhs)); | |
152 return *this; | |
153 } | |
154 #endif | |
155 | |
156 }; | |
157 }} | |
158 | |
159 #endif | |
160 #endif |