GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
Allocation.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Ivar Härnqvist
2// SPDX-License-Identifier: MIT
3
4#ifndef GREM_CORE_DATA_ALLOCATION_HPP
5#define GREM_CORE_DATA_ALLOCATION_HPP
6
8
10
11#include <algorithm> // std::min, std::fill_n, std::equal, std::lexicographical_compare
12#include <cstddef> // std::size_t, std::ptrdiff_t
13#include <initializer_list> // std::initializer_list
14#include <iterator> // std::reverse_iterator, std::input_iterator, std::random_access_iterator, std::sentinel_for, std::begin, std::end
15#include <limits> // std::numeric_limits
16#include <memory> // std::allocator, std::allocator_traits, std::to_address, std::uninitialized_..., std::destroy
17#include <memory_resource> // std::pmr::polymorphic_allocator
18#include <stdexcept> // std::out_of_range, std::length_error
19#include <type_traits> // std::is_..._v
20#include <utility> // std::move, std::forward, std::exchange, std::swap
21
22namespace grem {
23
24template <typename T, typename Allocator = std::allocator<T>>
26public:
27 using value_type = T;
28 using allocator_type = Allocator;
29 using size_type = std::size_t;
30 using difference_type = std::ptrdiff_t;
31 using reference = T&;
32 using const_reference = const T&;
33 using pointer = typename std::allocator_traits<Allocator>::pointer;
34 using const_pointer = typename std::allocator_traits<Allocator>::const_pointer;
37 using reverse_iterator = std::reverse_iterator<iterator>;
38 using const_reverse_iterator = std::reverse_iterator<const_iterator>;
39
40 constexpr Allocation() noexcept = default;
41
42 constexpr explicit Allocation(const Allocator& allocator) noexcept
43 : allocator(allocator) {}
44
45 constexpr explicit Allocation(size_type count, const Allocator& allocator = Allocator())
46 : Allocation(allocator) {
47 if (count > 0) {
48 if (count > max_size()) {
49 throw std::length_error{"count > max_size()"};
50 }
51 const pointer newElements = std::allocator_traits<Allocator>::allocate(this->allocator, count);
52 T* const pNewBegin = std::to_address(newElements);
53 T* const pNewEnd = pNewBegin + count;
54 if constexpr (std::is_trivially_default_constructible_v<T>) {
55 std::uninitialized_default_construct(pNewBegin, pNewEnd);
56 } else {
57 T* pNew = pNewBegin;
58 try {
59 while (pNew != pNewEnd) {
60 std::allocator_traits<Allocator>::construct(this->allocator, pNew++);
61 }
62 } catch (...) {
63 while (pNew != pNewBegin) {
64 std::allocator_traits<Allocator>::destroy(this->allocator, --pNew);
65 }
66 std::allocator_traits<Allocator>::deallocate(this->allocator, newElements, count);
67 throw;
68 }
69 }
70 elements = newElements;
71 elementCount = count;
72 }
73 }
74
75 constexpr Allocation(size_type count, const T& value, const Allocator& allocator = Allocator())
76 : Allocation(allocator) {
77 assign(count, value);
78 }
79
80 template <std::input_iterator InputIterator>
81 constexpr Allocation(InputIterator first, size_type count, const Allocator& allocator = Allocator())
82 : Allocation(allocator) {
83 assign(first, count);
84 }
85
86 template <std::random_access_iterator RandomAccessIterator, std::sentinel_for<RandomAccessIterator> Sentinel>
87 constexpr Allocation(RandomAccessIterator first, Sentinel last, const Allocator& allocator = Allocator())
88 : Allocation(allocator) {
89 assign(first, last);
90 }
91
92 constexpr Allocation(const Allocation& other)
93 : Allocation(other, std::allocator_traits<Allocator>::select_on_container_copy_construction(other.get_allocator())) {}
94
95 constexpr Allocation(const Allocation& other, const Allocator& allocator)
96 : Allocation(other.begin(), other.end(), allocator) {}
97
98 constexpr Allocation(Allocation&& other) noexcept
99 : Allocation(std::move(other), other.get_allocator()) {}
100
101 constexpr Allocation(Allocation&& other, const Allocator& allocator) noexcept // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
102 : elements(std::exchange(other.elements, nullptr))
103 , elementCount(std::exchange(other.elementCount, size_type{0}))
104 , allocator(allocator) {}
105
106 constexpr Allocation(std::initializer_list<T> ilist, const Allocator& allocator = Allocator())
107 : Allocation(ilist.begin(), ilist.end(), allocator) {}
108
109 constexpr ~Allocation() {
110 clear();
111 }
112
113 constexpr Allocation& operator=(const Allocation& other) {
114 if (this == &other) {
115 return *this;
116 }
117 if constexpr (std::allocator_traits<Allocator>::propagate_on_container_copy_assignment::value) {
118 if constexpr (!std::allocator_traits<Allocator>::is_always_equal::value) {
119 if (allocator != other.get_allocator()) {
120 clear();
121 }
122 }
123 allocator = other.get_allocator();
124 }
125 assign(other.begin(), other.end());
126 return *this;
127 }
128
129 constexpr Allocation& operator=(Allocation&& other) noexcept(
130 std::allocator_traits<
131 Allocator>::propagate_on_container_move_assignment::value || // NOLINT(cppcoreguidelines-noexcept-move-operations, performance-noexcept-move-constructor)
132 std::allocator_traits<Allocator>::is_always_equal::value) {
133 if (this == &other) {
134 return *this;
135 }
136 if constexpr (std::allocator_traits<Allocator>::propagate_on_container_move_assignment::value || std::allocator_traits<Allocator>::is_always_equal::value) {
137 clear();
138 elements = std::exchange(other.elements, nullptr);
139 elementCount = std::exchange(other.elementCount, size_type{0});
140 if constexpr (std::allocator_traits<Allocator>::propagate_on_container_move_assignment::value) {
141 allocator = other.allocator;
142 }
143 } else {
144 if (allocator == other.allocator) {
145 clear();
146 elements = std::exchange(other.elements, nullptr);
147 elementCount = std::exchange(other.elementCount, size_type{0});
148 } else {
149 GREM_ASSERT(other.elements);
150 *this = Allocation(other, allocator);
151 }
152 }
153 return *this;
154 }
155
156 constexpr Allocation& operator=(std::initializer_list<T> ilist) {
157 assign(ilist);
158 return *this;
159 }
160
161 constexpr void assign(size_type count, const T& value) {
162 if constexpr (std::is_copy_assignable_v<T>) {
163 if (count == size()) {
164 for (T& element : *this) {
165 element = value;
166 }
167 return;
168 }
169 }
170 if (count > 0) {
171 if (count > max_size()) {
172 throw std::length_error{"count > max_size()"};
173 }
174 const pointer newElements = std::allocator_traits<Allocator>::allocate(allocator, count);
175 T* const pNewBegin = std::to_address(newElements);
176 T* const pNewEnd = pNewBegin + count;
177 if constexpr (std::is_trivially_copy_constructible_v<T>) {
178 std::uninitialized_fill(pNewBegin, pNewEnd, value);
179 } else {
180 T* pNew = pNewBegin;
181 try {
182 while (pNew != pNewEnd) {
183 std::allocator_traits<Allocator>::construct(allocator, pNew++, value);
184 }
185 } catch (...) {
186 while (pNew != pNewBegin) {
187 std::allocator_traits<Allocator>::destroy(allocator, --pNew);
188 }
189 std::allocator_traits<Allocator>::deallocate(allocator, newElements, count);
190 throw;
191 }
192 }
193 clear();
194 elements = newElements;
195 elementCount = count;
196 } else {
197 clear();
198 }
199 }
200
201 template <std::input_iterator InputIterator>
202 constexpr void assign(InputIterator first, size_type count) {
203 if constexpr (std::is_copy_assignable_v<T>) {
204 if (count == size()) {
205 for (T& element : *this) {
206 element = *first++;
207 }
208 return;
209 }
210 }
211 if (count > 0) {
212 if (count > max_size()) {
213 throw std::length_error{"count > max_size()"};
214 }
215 const pointer newElements = std::allocator_traits<Allocator>::allocate(allocator, count);
216 T* const pNewBegin = std::to_address(newElements);
217 if constexpr (std::is_trivially_copy_constructible_v<T>) {
218 std::uninitialized_copy_n(first, count, pNewBegin);
219 } else {
220 T* const pNewEnd = pNewBegin + count;
221 T* pNew = pNewBegin;
222 try {
223 while (pNew != pNewEnd) {
224 std::allocator_traits<Allocator>::construct(allocator, pNew++, *first++);
225 }
226 } catch (...) {
227 while (pNew != pNewBegin) {
228 std::allocator_traits<Allocator>::destroy(allocator, --pNew);
229 }
230 std::allocator_traits<Allocator>::deallocate(allocator, newElements, count);
231 throw;
232 }
233 }
234 clear();
235 elements = newElements;
236 elementCount = count;
237 } else {
238 clear();
239 }
240 }
241
242 template <std::random_access_iterator RandomAccessIterator, std::sentinel_for<RandomAccessIterator> Sentinel>
243 constexpr void assign(RandomAccessIterator first, Sentinel last) {
244 assign(first, static_cast<size_type>(last - first));
245 }
246
247 constexpr void assign(std::initializer_list<T> ilist) {
248 assign(ilist.begin(), ilist.end());
249 }
250
251 template <typename R>
252 constexpr void assign_range(R&& r) { // NOLINT(cppcoreguidelines-missing-std-forward)
253 assign(std::begin(r), std::end(r));
254 }
255
256 constexpr void clear() noexcept {
257 if (elements) {
258 T* const pBegin = std::to_address(elements);
259 T* const pEnd = pBegin + elementCount;
260 if constexpr (std::is_trivially_destructible_v<T>) {
261 std::destroy(pBegin, pEnd);
262 } else {
263 for (T* p = pBegin; p != pEnd; ++p) {
264 std::allocator_traits<Allocator>::destroy(allocator, p);
265 }
266 }
267 std::allocator_traits<Allocator>::deallocate(allocator, elements, elementCount);
268 elements = nullptr;
269 elementCount = 0;
270 }
271 }
272
273 constexpr void resize(size_type count) {
274 if (count != size()) {
275 if (count > 0) {
276 if (count > max_size()) {
277 throw std::length_error{"count > max_size()"};
278 }
279 const pointer newElements = std::allocator_traits<Allocator>::allocate(allocator, count);
280 T* const pNewBegin = std::to_address(newElements);
281 T* const pOldBegin = std::to_address(elements);
282 T* const pNewEnd = pNewBegin + count;
283 T* const pOldEnd = pOldBegin + elementCount;
284 if constexpr (std::is_trivially_move_constructible_v<T> && std::is_trivially_default_constructible_v<T>) {
285 if (count > elementCount) {
286 std::uninitialized_move(pOldBegin, pOldEnd, pNewBegin);
287 std::uninitialized_default_construct(pNewBegin + elementCount, pNewEnd);
288 } else {
289 std::uninitialized_move(pOldBegin, pOldBegin + count, pNewBegin);
290 }
291 } else {
292 T* pNew = pNewBegin;
293 T* pOld = pOldBegin;
294 try {
295 while (pNew != pNewEnd && pOld != pOldEnd) {
296 if constexpr (std::is_nothrow_move_assignable_v<T>) {
297 std::allocator_traits<Allocator>::construct(allocator, pNew++, std::move(*pOld++));
298 } else {
299 std::allocator_traits<Allocator>::construct(allocator, pNew++, *pOld++);
300 }
301 }
302 while (pNew != pNewEnd) {
303 std::allocator_traits<Allocator>::construct(allocator, pNew++);
304 }
305 } catch (...) {
306 while (pNew != pNewBegin) {
307 std::allocator_traits<Allocator>::destroy(allocator, --pNew);
308 }
309 std::allocator_traits<Allocator>::deallocate(allocator, newElements, count);
310 throw;
311 }
312 }
313 clear();
314 elements = newElements;
315 elementCount = count;
316 } else {
317 clear();
318 }
319 }
320 }
321
322 constexpr void resize(size_type count, const T& value) {
323 if (count != size()) {
324 if (count > 0) {
325 if (count > max_size()) {
326 throw std::length_error{"count > max_size()"};
327 }
328 const pointer newElements = std::allocator_traits<Allocator>::allocate(allocator, count);
329 T* const pNewBegin = std::to_address(newElements);
330 T* const pNewEnd = pNewBegin + count;
331 T* const pOldBegin = std::to_address(elements);
332 T* const pOldEnd = pOldBegin + elementCount;
333 if constexpr (std::is_trivially_move_constructible_v<T> && std::is_trivially_copy_constructible_v<T>) {
334 if (count > elementCount) {
335 std::uninitialized_move(pOldBegin, pOldEnd, pNewBegin);
336 std::uninitialized_fill(pNewBegin + elementCount, pNewEnd, value);
337 } else {
338 std::uninitialized_move(pOldBegin, pOldBegin + count, pNewBegin);
339 }
340 } else {
341 T* pNew = pNewBegin;
342 T* pOld = pOldBegin;
343 try {
344 while (pNew != pNewEnd && pOld != pOldEnd) {
345 if constexpr (std::is_nothrow_move_assignable_v<T>) {
346 std::allocator_traits<Allocator>::construct(allocator, pNew++, std::move(*pOld++));
347 } else {
348 std::allocator_traits<Allocator>::construct(allocator, pNew++, *pOld++);
349 }
350 }
351 while (pNew != pNewEnd) {
352 std::allocator_traits<Allocator>::construct(allocator, pNew++, value);
353 }
354 } catch (...) {
355 while (pNew != pNewBegin) {
356 std::allocator_traits<Allocator>::destroy(allocator, --pNew);
357 }
358 std::allocator_traits<Allocator>::deallocate(allocator, newElements, count);
359 throw;
360 }
361 }
362 clear();
363 elements = newElements;
364 elementCount = count;
365 } else {
366 clear();
367 }
368 }
369 }
370
371 [[nodiscard]] constexpr allocator_type get_allocator() const noexcept {
372 return allocator;
373 }
374
375 [[nodiscard]] constexpr reference at(size_type pos) {
376 if (pos >= elementCount) {
377 throw std::out_of_range{"pos >= size()"};
378 }
379 return (*this)[pos];
380 }
381
382 [[nodiscard]] constexpr const_reference at(size_type pos) const {
383 if (pos >= elementCount) {
384 throw std::out_of_range{"pos >= size()"};
385 }
386 return (*this)[pos];
387 }
388
389 [[nodiscard]] constexpr reference operator[](size_type pos) {
390 GREM_ASSERT(elements);
391 GREM_ASSERT(pos < elementCount);
392 return elements[pos];
393 }
394
395 [[nodiscard]] constexpr const_reference operator[](size_type pos) const {
396 GREM_ASSERT(elements);
397 GREM_ASSERT(pos < elementCount);
398 return elements[pos];
399 }
400
401 [[nodiscard]] constexpr reference front() {
402 GREM_ASSERT(elements);
403 GREM_ASSERT(elementCount > 0);
404 return elements[0];
405 }
406
407 [[nodiscard]] constexpr const_reference front() const {
408 GREM_ASSERT(elements);
409 GREM_ASSERT(elementCount > 0);
410 return elements[0];
411 }
412
413 [[nodiscard]] constexpr reference back() {
414 GREM_ASSERT(elements);
415 GREM_ASSERT(elementCount > 0);
416 return elements[elementCount - 1];
417 }
418
419 [[nodiscard]] constexpr const_reference back() const {
420 GREM_ASSERT(elements);
421 GREM_ASSERT(elementCount > 0);
422 return elements[elementCount - 1];
423 }
424
425 [[nodiscard]] constexpr pointer data() noexcept {
426 return elements;
427 }
428
429 [[nodiscard]] constexpr const_pointer data() const noexcept {
430 return elements;
431 }
432
433 [[nodiscard]] constexpr iterator begin() noexcept {
434 return iterator{elements};
435 }
436
437 [[nodiscard]] constexpr const_iterator begin() const noexcept {
438 return const_iterator{elements};
439 }
440
441 [[nodiscard]] constexpr const_iterator cbegin() const noexcept {
442 return begin();
443 }
444
445 [[nodiscard]] constexpr iterator end() noexcept {
446 return iterator{elements + elementCount};
447 }
448
449 [[nodiscard]] constexpr const_iterator end() const noexcept {
450 return const_iterator{elements + elementCount};
451 }
452
453 [[nodiscard]] constexpr const_iterator cend() const noexcept {
454 return end();
455 }
456
457 [[nodiscard]] constexpr reverse_iterator rbegin() noexcept {
458 return reverse_iterator{end()};
459 }
460
461 [[nodiscard]] constexpr const_reverse_iterator rbegin() const noexcept {
462 return const_reverse_iterator{end()};
463 }
464
465 [[nodiscard]] constexpr const_reverse_iterator crbegin() const noexcept {
467 }
468
469 [[nodiscard]] constexpr reverse_iterator rend() noexcept {
470 return reverse_iterator{begin()};
471 }
472
473 [[nodiscard]] constexpr const_reverse_iterator rend() const noexcept {
475 }
476
477 [[nodiscard]] constexpr const_reverse_iterator crend() const noexcept {
479 }
480
481 [[nodiscard]] constexpr bool empty() const noexcept {
482 return elementCount == 0;
483 }
484
485 [[nodiscard]] constexpr size_type size() const noexcept {
486 return elementCount;
487 }
488
489 [[nodiscard]] constexpr size_type max_size() const noexcept {
490 return std::min({
491 static_cast<size_type>(std::numeric_limits<difference_type>::max()),
492 static_cast<size_type>(std::numeric_limits<size_type>::max() / sizeof(T)),
493 static_cast<size_type>(std::allocator_traits<Allocator>::max_size(allocator)),
494 });
495 }
496
497 constexpr void fill(const T& value) {
498 std::fill_n(elements, elementCount, value);
499 }
500
501 constexpr void swap(Allocation& other) noexcept(
502 std::allocator_traits<Allocator>::is_always_equal::value) { // NOLINT(cppcoreguidelines-noexcept-swap, performance-noexcept-swap)
503 if (this == &other) {
504 return;
505 }
506 using std::swap;
507 swap(elements, other.elements);
508 swap(elementCount, other.elementCount);
509 if constexpr (std::allocator_traits<Allocator>::propagate_on_container_swap::value) {
510 swap(allocator, other.allocator);
511 } else if constexpr (!std::allocator_traits<Allocator>::is_always_equal::value) {
512 GREM_ASSERT(allocator == other.allocator);
513 }
514 }
515
516 friend constexpr void swap(Allocation& a, Allocation& b) noexcept(noexcept(a.swap(b))) { // NOLINT(cppcoreguidelines-noexcept-swap, performance-noexcept-swap)
517 a.swap(b);
518 }
519
520 [[nodiscard]] constexpr bool operator==(const Allocation& other) const {
521 return std::equal(begin(), end(), other.begin(), other.end());
522 }
523
524 [[nodiscard]] constexpr bool operator<(const Allocation& other) const {
525 return std::lexicographical_compare(begin(), end(), other.begin(), other.end());
526 }
527
528 [[nodiscard]] constexpr bool operator<=(const Allocation& other) const {
529 return !(other < *this);
530 }
531
532 [[nodiscard]] constexpr bool operator>(const Allocation& other) const {
533 return other < *this;
534 }
535
536 [[nodiscard]] constexpr bool operator>=(const Allocation& other) const {
537 return !(*this < other);
538 }
539
540 constexpr pointer release() noexcept {
541 const pointer result = std::exchange(elements, nullptr);
542 elementCount = 0;
543 return result;
544 }
545
546private:
547 pointer elements = nullptr;
548 size_type elementCount = 0;
549 [[no_unique_address]] Allocator allocator;
550};
551
552} // namespace grem
553
554namespace grem::pmr {
555
556template <typename T>
558
559} // namespace grem::pmr
560
561#endif
#define GREM_ASSERT(expression)
Definition assertions.hpp:77
Definition Allocation.hpp:25
typename std::allocator_traits< Allocator >::const_pointer const_pointer
Definition Allocation.hpp:34
std::size_t size_type
Definition Allocation.hpp:29
Allocator allocator_type
Definition Allocation.hpp:28
constexpr bool operator==(const Allocation &other) const
Definition Allocation.hpp:520
constexpr const_reference front() const
Definition Allocation.hpp:407
constexpr reference back()
Definition Allocation.hpp:413
constexpr reverse_iterator rbegin() noexcept
Definition Allocation.hpp:457
constexpr void swap(Allocation &other) noexcept(std::allocator_traits< Allocator >::is_always_equal::value)
Definition Allocation.hpp:501
const_pointer const_iterator
Definition Allocation.hpp:36
constexpr bool operator>(const Allocation &other) const
Definition Allocation.hpp:532
constexpr Allocation(Allocation &&other) noexcept
Definition Allocation.hpp:98
constexpr Allocation(RandomAccessIterator first, Sentinel last, const Allocator &allocator=Allocator())
Definition Allocation.hpp:87
constexpr reference at(size_type pos)
Definition Allocation.hpp:375
constexpr Allocation & operator=(Allocation &&other) noexcept(std::allocator_traits< Allocator >::propagate_on_container_move_assignment::value||//NOLINT(cppcoreguidelines-noexcept-move-operations, performance-noexcept-move-constructor) std::allocator_traits< Allocator >::is_always_equal::value)
Definition Allocation.hpp:129
constexpr Allocation() noexcept=default
constexpr void assign(RandomAccessIterator first, Sentinel last)
Definition Allocation.hpp:243
constexpr void resize(size_type count)
Definition Allocation.hpp:273
std::ptrdiff_t difference_type
Definition Allocation.hpp:30
constexpr Allocation(const Allocation &other, const Allocator &allocator)
Definition Allocation.hpp:95
constexpr Allocation & operator=(std::initializer_list< T > ilist)
Definition Allocation.hpp:156
constexpr const_reverse_iterator rbegin() const noexcept
Definition Allocation.hpp:461
constexpr iterator begin() noexcept
Definition Allocation.hpp:433
constexpr void assign_range(R &&r)
Definition Allocation.hpp:252
constexpr bool operator>=(const Allocation &other) const
Definition Allocation.hpp:536
constexpr void assign(InputIterator first, size_type count)
Definition Allocation.hpp:202
constexpr Allocation(std::initializer_list< T > ilist, const Allocator &allocator=Allocator())
Definition Allocation.hpp:106
constexpr const_reverse_iterator crbegin() const noexcept
Definition Allocation.hpp:465
constexpr pointer data() noexcept
Definition Allocation.hpp:425
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition Allocation.hpp:38
constexpr const_reverse_iterator crend() const noexcept
Definition Allocation.hpp:477
pointer iterator
Definition Allocation.hpp:35
constexpr allocator_type get_allocator() const noexcept
Definition Allocation.hpp:371
constexpr void assign(size_type count, const T &value)
Definition Allocation.hpp:161
T value_type
Definition Allocation.hpp:27
friend constexpr void swap(Allocation &a, Allocation &b) noexcept(noexcept(a.swap(b)))
Definition Allocation.hpp:516
std::reverse_iterator< iterator > reverse_iterator
Definition Allocation.hpp:37
constexpr const_reference at(size_type pos) const
Definition Allocation.hpp:382
constexpr const_reference back() const
Definition Allocation.hpp:419
constexpr Allocation(const Allocation &other)
Definition Allocation.hpp:92
constexpr const_iterator end() const noexcept
Definition Allocation.hpp:449
constexpr size_type size() const noexcept
Definition Allocation.hpp:485
constexpr const_reverse_iterator rend() const noexcept
Definition Allocation.hpp:473
constexpr const_iterator begin() const noexcept
Definition Allocation.hpp:437
constexpr Allocation & operator=(const Allocation &other)
Definition Allocation.hpp:113
constexpr Allocation(Allocation &&other, const Allocator &allocator) noexcept
Definition Allocation.hpp:101
T & reference
Definition Allocation.hpp:31
constexpr reverse_iterator rend() noexcept
Definition Allocation.hpp:469
constexpr bool operator<=(const Allocation &other) const
Definition Allocation.hpp:528
constexpr size_type max_size() const noexcept
Definition Allocation.hpp:489
constexpr iterator end() noexcept
Definition Allocation.hpp:445
constexpr Allocation(InputIterator first, size_type count, const Allocator &allocator=Allocator())
Definition Allocation.hpp:81
constexpr bool empty() const noexcept
Definition Allocation.hpp:481
constexpr void assign(std::initializer_list< T > ilist)
Definition Allocation.hpp:247
constexpr reference operator[](size_type pos)
Definition Allocation.hpp:389
constexpr reference front()
Definition Allocation.hpp:401
constexpr const_iterator cbegin() const noexcept
Definition Allocation.hpp:441
constexpr bool operator<(const Allocation &other) const
Definition Allocation.hpp:524
constexpr ~Allocation()
Definition Allocation.hpp:109
constexpr void fill(const T &value)
Definition Allocation.hpp:497
constexpr Allocation(size_type count, const Allocator &allocator=Allocator())
Definition Allocation.hpp:45
constexpr const_reference operator[](size_type pos) const
Definition Allocation.hpp:395
const T & const_reference
Definition Allocation.hpp:32
constexpr const_iterator cend() const noexcept
Definition Allocation.hpp:453
constexpr pointer release() noexcept
Definition Allocation.hpp:540
constexpr const_pointer data() const noexcept
Definition Allocation.hpp:429
constexpr void resize(size_type count, const T &value)
Definition Allocation.hpp:322
constexpr void clear() noexcept
Definition Allocation.hpp:256
constexpr Allocation(size_type count, const T &value, const Allocator &allocator=Allocator())
Definition Allocation.hpp:75
Definition concepts.hpp:106
Definition Allocation.hpp:554
grem::Allocation< T, std::pmr::polymorphic_allocator< T > > Allocation
Definition Allocation.hpp:557
Definition aliases.hpp:9
constexpr auto count(input_range auto &&range, const auto &value)
Definition algorithms.hpp:234