mCRL2
Loading...
Searching...
No Matches
deque.h
Go to the documentation of this file.
1// Author(s): Jan Friso Groote, Maurice Laveaux
2// Copyright: see the accompanying file COPYING or copy at
3// https://github.com/mCRL2org/mCRL2/blob/master/COPYING
4//
5// Distributed under the Boost Software License, Version 1.0.
6// (See accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8//
9//
17
18#ifndef MCRL2_ATERMPP_STANDARD_CONTAINER_DEQUE_H
19#define MCRL2_ATERMPP_STANDARD_CONTAINER_DEQUE_H
20
21#include <deque>
26
28namespace atermpp
29{
30
32template < class T, class Alloc = std::allocator<detail::reference_aterm<T> > >
33class deque : public std::deque< detail::reference_aterm<T>, Alloc >
34{
35protected:
36 typedef std::deque< detail::reference_aterm<T>, Alloc > super;
37
39
40public:
41
43 typedef typename super::allocator_type allocator_type;
44 typedef typename super::value_type value_type;
45 typedef typename super::size_type size_type;
46 typedef typename super::reference reference;
47 typedef typename super::iterator iterator;
48 typedef typename super::const_iterator const_iterator;
49
52 : super(),
53 container_wrapper(*this)
54 {}
55
57 explicit deque (const allocator_type& alloc)
58 : super::deque(alloc),
59 container_wrapper(*this)
60 {}
61
63 explicit deque (size_type n, const allocator_type& alloc = allocator_type())
64 : super::deque(n, alloc),
66 {}
67
69 deque(size_type n, const value_type& val, const allocator_type& alloc = allocator_type())
70 : super::deque(n, detail::reference_aterm(val), alloc),
71 container_wrapper(*this)
72 {}
73
75 template <class InputIterator>
76 deque(InputIterator first, InputIterator last, const allocator_type& alloc = allocator_type())
77 : super::deque(first, last, alloc),
78 container_wrapper(*this)
79 {}
80
82 deque(const deque& x)
83 : super::deque(x),
84 container_wrapper(*this)
85 {}
86
88 deque(const deque& x, const allocator_type& alloc)
89 : super::deque(x, alloc),
90 container_wrapper(*this)
91 {}
92
95 : super::deque(std::move(x)),
96 container_wrapper(*this)
97 {}
98
100 deque(deque&& x, const allocator_type& alloc)
101 : super::deque(std::move(x), alloc),
102 container_wrapper(*this)
103 {}
104
106 deque(std::initializer_list<value_type> il, const allocator_type& alloc = allocator_type())
107 : super::deque(il.begin(), il.end(), alloc),
108 container_wrapper(*this)
109 {}
110
112 deque& operator=(const deque& other) = default;
113
115 deque& operator=(deque&& other) = default;
116
118 ~deque() = default;
119
121 {
123 super::shrink_to_fit();
124 }
125
126 void clear() noexcept
127 {
129 super::clear();
130 }
131
132 iterator insert( const_iterator pos, const T& value )
133 {
135 return super::insert(pos, value);
136 }
137
139 {
141 return super::insert(pos, value);
142 }
143
144 iterator insert( const_iterator pos, size_type count, const T& value )
145 {
147 return super::insert(pos, count, value);
148 }
149
150 template< class InputIt >
152 InputIt first, InputIt last )
153 {
155 return super::insert(pos, first, last);
156 }
157
158 iterator insert( const_iterator pos, std::initializer_list<T> ilist )
159 {
161 return super::insert(pos, ilist);
162 }
163
164 template< class... Args >
165 iterator emplace( const_iterator pos, Args&&... args )
166 {
168 return super::emplace(pos, args...);
169 }
170
172 {
174 return super::erase(pos);
175 }
176
178 {
180 return super::erase(first, last);
181 }
182
183 void push_back( const T& value )
184 {
186 return super::push_back(value);
187 }
188
189 void push_back( T&& value )
190 {
192 return super::push_back(value);
193 }
194
195 template< class... Args >
196 reference emplace_back( Args&&... args )
197 {
199 return super::emplace_back(args...);
200 }
201
202 void pop_back()
203 {
205 super::pop_back();
206 }
207
208 void push_front( const T& value )
209 {
211 super::push_front(value);
212 }
213
214 void push_front( T&& value )
215 {
217 super::push_front(value);
218 }
219
220 template< class... Args >
221 reference emplace_front( Args&&... args )
222 {
224 super::emplace_front(args...);
225 }
226
227 void resize( size_type count )
228 {
230 super::resize(count);
231 }
232
233 void resize( size_type count, const value_type& value )
234 {
236 super::resize(count, value);
237 }
238
239 std::size_t size() const
240 {
241 return super::size();
242 }
243
244 void swap( deque& other ) noexcept
245 {
247 super::swap(other); // Invalidates end() so must be protected.
248 }
249};
250
251} // namespace atermpp
252#endif // MCRL2_ATERMPP_STANDARD_CONTAINER_DEQUE_H
A deque class in which aterms can be stored.
Definition deque.h:34
void push_front(T &&value)
Definition deque.h:214
iterator insert(const_iterator pos, const T &value)
Definition deque.h:132
deque()
Default constructor.
Definition deque.h:51
iterator erase(const_iterator first, const_iterator last)
Definition deque.h:177
void pop_back()
Definition deque.h:202
iterator insert(const_iterator pos, size_type count, const T &value)
Definition deque.h:144
deque(InputIterator first, InputIterator last, const allocator_type &alloc=allocator_type())
Constructor.
Definition deque.h:76
std::size_t size() const
Definition deque.h:239
deque & operator=(deque &&other)=default
Move assignment operator.
std::deque< detail::reference_aterm< T >, Alloc > super
Definition deque.h:36
reference emplace_back(Args &&... args)
Definition deque.h:196
iterator insert(const_iterator pos, T &&value)
Definition deque.h:138
void clear() noexcept
Definition deque.h:126
deque(const deque &x, const allocator_type &alloc)
Constructor.
Definition deque.h:88
deque(size_type n, const value_type &val, const allocator_type &alloc=allocator_type())
Constructor.
Definition deque.h:69
super::const_iterator const_iterator
Definition deque.h:48
deque(deque &&x, const allocator_type &alloc)
Constructor.
Definition deque.h:100
super::allocator_type allocator_type
Standard typedefs.
Definition deque.h:43
void push_back(const T &value)
Definition deque.h:183
deque(std::initializer_list< value_type > il, const allocator_type &alloc=allocator_type())
Constructor.
Definition deque.h:106
void resize(size_type count, const value_type &value)
Definition deque.h:233
iterator insert(const_iterator pos, std::initializer_list< T > ilist)
Definition deque.h:158
iterator insert(const_iterator pos, InputIt first, InputIt last)
Definition deque.h:151
deque(const deque &x)
Constructor.
Definition deque.h:82
deque & operator=(const deque &other)=default
Copy assignment operator.
super::value_type value_type
Definition deque.h:44
iterator emplace(const_iterator pos, Args &&... args)
Definition deque.h:165
~deque()=default
Standard destructor.
reference emplace_front(Args &&... args)
Definition deque.h:221
void swap(deque &other) noexcept
Definition deque.h:244
super::iterator iterator
Definition deque.h:47
detail::generic_aterm_container< std::deque< detail::reference_aterm< T >, Alloc > > container_wrapper
Definition deque.h:38
void resize(size_type count)
Definition deque.h:227
void push_back(T &&value)
Definition deque.h:189
iterator erase(const_iterator pos)
Definition deque.h:171
super::reference reference
Definition deque.h:46
deque(const allocator_type &alloc)
Constructor.
Definition deque.h:57
deque(deque &&x)
Constructor.
Definition deque.h:94
void shrink_to_fit()
Definition deque.h:120
super::size_type size_type
Definition deque.h:45
void push_front(const T &value)
Definition deque.h:208
deque(size_type n, const allocator_type &alloc=allocator_type())
Constructor.
Definition deque.h:63
mcrl2::utilities::shared_guard lock_shared()
Acquire a shared lock on this thread aterm pool.
A shared lock guard for the shared_mutex.
thread_aterm_pool & g_thread_term_pool()
A reference to the thread local term pool storage.
The main namespace for the aterm++ library.
Definition algorithm.h:21
STL namespace.