Debian Codegraph @

headers/deque

raw
1 /* Copyright (C) 2015 Povilas Kanapickas <[email protected]>
2
3 This file is part of cppreference-doc
4
5 This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
6 Unported License. To view a copy of this license, visit
7 http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative
8 Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
9
10 Permission is granted to copy, distribute and/or modify this document
11 under the terms of the GNU Free Documentation License, Version 1.3 or
12 any later version published by the Free Software Foundation; with no
13 Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
14 */
15
16 #ifndef CPPREFERENCE_DEQUE_H
17 #define CPPREFERENCE_DEQUE_H
18
19 #if CPPREFERENCE_STDVER>= 2011
20 #include <initializer_list>
21 #endif
22
23 namespace std {
24
25 template<class T, class Allocator = allocator<T>>
26 class deque {
27 public:
28 typedef T value_type;
29 typedef Allocator allocator_type;
30 typedef size_t size_type; // actual type unspecified
31 typedef ptrdiff_t difference_type; // actual type not specified
32 #if CPPREFERENCE_SIMPLIFY_TYPEDEFS
33 typedef T& reference;
34 typedef const T& const_reference;
35 typedef T* pointer;
36 typedef const T* const_pointer;
37 #elif CPPREFERENCE_STDVER <2011
38 typedef typename Allocator::reference reference;
39 typedef typename Allocator::const_reference const_reference;
40 typedef typename Allocator::pointer pointer;
41 typedef typename Allocator::const_pointer const_pointer;
42 #else
43 typedef value_type& reference;
44 typedef const value_type& const_reference;
45 typedef typename std::allocator_traits<Allocator>::pointer pointer;
46 typedef typename std::allocator_traits<Allocator>::const_pointer const_pointer;
47 #endif
48 typedef T* iterator; // actual type is unspecified
49 typedef const T* const_iterator; // actual type is unspecified
50 typedef std::reverse_iterator<iterator> reverse_iterator;
51 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
52
53 // constructor
54 #if CPPREFERENCE_STDVER <2014
55 explicit deque(const Allocator& alloc = Allocator());
56 #else
57 deque();
58 explicit deque(const Allocator& alloc);
59 #endif
60
61 #if CPPREFERENCE_STDVER <2011
62 explicit deque(size_type count,
63 const T& value = T(),
64 const Allocator& alloc = Allocator());
65 #else
66 deque(size_type count,
67 const T& value,
68 const Allocator& alloc = Allocator());
69
70 #if CPPREFERENCE_STDVER <2014
71 explicit deque(size_type n);
72 #else
73 explicit deque(size_type n, const Allocator& alloc = Allocator());
74 #endif
75
76 template<class InputIt>
77 deque(InputIt first, InputIt last,
78 const Allocator& alloc = Allocator());
79
80 deque(const deque& other);
81 #if CPPREFERENCE_STDVER>= 2011
82 deque(const deque& other, const Allocator& alloc);
83 #endif
84
85 deque(deque&& other);
86 #if CPPREFERENCE_STDVER>= 2011
87 deque(deque&& other, const Allocator& alloc);
88
89 deque(std::initializer_list<T> init,
90 const Allocator& alloc = Allocator());
91 #endif
92
93 ~deque();
94
95 deque& operator=(const deque& other);
96 #if CPPREFERENCE_STDVER>= 2011
97 deque& operator=(deque&& other);
98 deque& operator=(initializer_list<T> ilist);
99 #endif
100
101 void assign(size_type count, const value_type& value);
102 template <class InputIt>
103 void assign(InputIt first, InputIt last);
104 #if CPPREFERENCE_STDVER>= 2011
105 void assign(std::initializer_list<T> ilist);
106 #endif
107
108 allocator_type get_allocator() const;
109
110 // element access
111 reference at(size_type n);
112 const_reference at(size_type n) const;
113 reference operator[](size_type n);
114 const_reference operator[](size_type n) const;
115
116 reference front();
117 const_reference front() const;
118 reference back();
119 const_reference back() const;
120
121 // iterators
122 iterator begin();
123 const_iterator begin() const;
124 iterator end();
125 const_iterator end() const;
126
127 reverse_iterator rbegin();
128 const_reverse_iterator rbegin() const;
129 reverse_iterator rend();
130 const_reverse_iterator rend() const;
131
132 #if CPPREFERENCE_STDVER>= 2011
133 const_iterator cbegin() const;
134 const_iterator cend() const;
135 const_reverse_iterator crbegin() const;
136 const_reverse_iterator crend() const;
137 #endif
138
139 bool empty() const;
140 size_type size() const;
141 size_type max_size() const;
142 void reserve(size_type n);
143 size_type capacity() const;
144
145 #if CPPREFERENCE_STDVER>= 2011
146 void shrink_to_fit();
147 #endif
148
149 // modifiers
150 void clear();
151
152 #if CPPREFERENCE_STDVER <2011
153 iterator insert(iterator pos, const T& value);
154 void insert(iterator pos, size_type count, const T& value);
155 template<class InputIt>
156 void insert(iterator pos, InputIt first, InputIt last);
157 #else
158 iterator insert(const_iterator pos, const T& value);
159 iterator insert(const_iterator pos, T&& value);
160 iterator insert(const_iterator pos, size_type count, const T& value);
161 template<class InputIt>
162 iterator insert(const_iterator pos, InputIt first, InputIt last);
163 iterator insert(const_iterator pos, std::initializer_list<T> ilist);
164 #endif
165
166 #if CPPREFERENCE_STDVER>= 2011
167 template<class... Args>
168 iterator emplace(const_iterator pos, Args&& ... args);
169 #endif
170
171 #if CPPREFERENCE_STDVER <2011
172 iterator erase(iterator pos);
173 iterator erase(iterator first, iterator last);
174 #else
175 iterator erase(const_iterator pos);
176 iterator erase(const_iterator first, const_iterator last);
177 #endif
178
179 void push_back(const T& value);
180 #if CPPREFERENCE_STDVER> 2011
181 void push_back(T&& value);
182 #endif
183
184 #if CPPREFERENCE_STDVER>= 2011
185 template<class... Args>
186 void emplace_back(Args&& ... args);
187 #endif
188
189 void pop_back();
190
191 void push_front(const T& value);
192 #if CPPREFERENCE_STDVER>= 2011
193 void push_front(T&& value);
194 #endif
195
196 #if CPPREFERENCE_STDVER>= 2011
197 template<class... Args>
198 void emplace_front(Args&& ... args);
199 #endif
200
201 void pop_front();
202
203 #if CPPREFERENCE_STDVER <2011
204 void resize(size_type count, T value = T());
205 #else
206 void resize(size_type count);
207 void resize(size_type count, const value_type& value);
208 #endif
209
210 void swap(deque& other);
211 };
212
213 template<class T, class Alloc>
214 bool operator==(const deque<T, Alloc>& lhs,
215 const deque<T, Alloc>& rhs);
216
217 template<class T, class Alloc>
218 bool operator!=(const deque<T, Alloc>& lhs,
219 const deque<T, Alloc>& rhs);
220
221 template<class T, class Alloc>
222 bool operator<(const deque<T, Alloc>& lhs,
223 const deque<T, Alloc>& rhs);
224
225 template<class T, class Alloc>
226 bool operator<=(const deque<T, Alloc>& lhs,
227 const deque<T, Alloc>& rhs);
228
229 template<class T, class Alloc>
230 bool operator>(const deque<T, Alloc>& lhs,
231 const deque<T, Alloc>& rhs);
232
233 template<class T, class Alloc>
234 bool operator>=(const deque<T, Alloc>& lhs,
235 const deque<T, Alloc>& rhs);
236
237 } // namespace std
238
239 #endif // CPPREFERENCE_DEQUE_H