KSSUtil  v14.2.0
C++ general utility library
circular_array.hpp
Go to the documentation of this file.
1 // \file circular_array.hpp
2 // \author Steven W. Klassen (klassens@acm.org)
3 // \date Sat Sep 20 2003
4 // \brief Circular array container.
5 //
6 // This file is Copyright (c) 2003 by Klassen Software Solutions. All rights reserved.
7 // Licensing follows the MIT License.
8 //
9 
10 #ifndef kssutil_circular_array_hpp
11 #define kssutil_circular_array_hpp
12 
13 #include <algorithm>
14 #include <initializer_list>
15 #include <iterator>
16 #include <memory>
17 #include <stdexcept>
18 #include <utility>
19 
20 #include <kss/contract/all.h>
21 
22 #include "algorithm.hpp"
23 #include "iterator.hpp"
24 #include "memory.hpp"
25 
31 namespace kss { namespace util { namespace containers {
32 
66  template <class T, class A = std::allocator<T>>
67  class CircularArray : public kss::util::AddRelOps<CircularArray<T, A>> {
68  public:
69  using value_type = T;
70  using allocator_type = A;
71  using size_type = typename A::size_type;
72  using difference_type = typename A::difference_type;
75  using reverse_iterator = std::reverse_iterator<iterator>;
76  using const_reverse_iterator = std::reverse_iterator<const_iterator>;
77  using pointer = typename A::pointer;
78  using const_pointer = typename A::const_pointer;
79  using reference = typename A::reference;
80  using const_reference = typename A::const_reference;
81 
87  explicit CircularArray(size_type cap = size_type(10), const A& allocator = A())
88  : _allocator(allocator)
89  {
90  init(cap);
91 
92  kss::contract::postconditions({
93  KSS_EXPR(_array != nullptr),
94  KSS_EXPR(_capacity == cap),
95  KSS_EXPR(_size == 0),
96  KSS_EXPR(_first == 0),
97  KSS_EXPR(_last == _size)
98  });
99  }
100 
102  const value_type& val,
103  size_type cap = size_type(10),
104  const A& allocator = A())
105  : _allocator(allocator)
106  {
107  init(std::max(n, cap));
108  assign(n, val);
109 
110  kss::contract::postconditions({
111  KSS_EXPR(_array != nullptr),
112  KSS_EXPR(_capacity == std::max(n, cap)),
113  KSS_EXPR(_size == n),
114  KSS_EXPR(_first == 0),
115  KSS_EXPR((_last == _size) || (_last == 0 && _size == _capacity))
116  });
117  }
118 
119  template <class InputIterator>
120  CircularArray(InputIterator first,
121  InputIterator last,
122  size_type cap = size_type(10),
123  const A& allocator = A())
124  : _allocator(allocator)
125  {
126  init(cap);
127  assign(first, last);
128 
129  kss::contract::postconditions({
130  KSS_EXPR(_array != nullptr),
131  KSS_EXPR(_capacity >= cap),
132  KSS_EXPR(_capacity >= _size),
133  KSS_EXPR(_first == 0),
134  KSS_EXPR((_last == _size) || (_last == 0 && _size == _capacity))
135  });
136  }
137 
139  size_type cap = size_type(10),
140  const A& allocator = A())
141  : _allocator(allocator)
142  {
143  init(std::max(ca.size(), cap));
144  assign(ca.begin(), ca.end());
145 
146  kss::contract::postconditions({
147  KSS_EXPR(_array != nullptr),
148  KSS_EXPR(_capacity == std::max(ca.size(), cap)),
149  KSS_EXPR(_size == ca.size()),
150  KSS_EXPR(_first == 0),
151  KSS_EXPR((_last == _size) || (_last == 0 && _size == _capacity)),
152  KSS_EXPR(*this == ca)
153  });
154  }
155 
157  _array = ca._array;
158  _capacity = ca._capacity;
159  _first = ca._first;
160  _last = ca._last;
161  _size = ca._size;
162  _allocator = ca._allocator;
163 
164  ca._array = nullptr;
165  ca._capacity = ca._first = ca._last = ca._size = 0;
166 
167  kss::contract::postconditions({
168  KSS_EXPR(_array != nullptr),
169  KSS_EXPR(_capacity >= _size),
170  KSS_EXPR(_capacity > 0),
171  KSS_EXPR(ca._array == nullptr),
172  KSS_EXPR(ca._size == 0),
173  KSS_EXPR(ca._capacity == 0)
174  });
175  }
176 
177  CircularArray(std::initializer_list<value_type> il,
178  size_type cap = size_type(10),
179  const A& allocator = A())
180  : _allocator(allocator)
181  {
182  init(std::max(il.size(), cap));
183  assign(il);
184 
185  kss::contract::postconditions({
186  KSS_EXPR(_array != nullptr),
187  KSS_EXPR(_capacity == std::max(il.size(), cap)),
188  KSS_EXPR(_size == il.size()),
189  KSS_EXPR(_first == 0),
190  KSS_EXPR((_last == _size) || (_last == 0 && _size == _capacity))
191  });
192  }
193 
194  ~CircularArray() noexcept {
195  teardown();
196  }
197 
204  if (&ca != this) {
205  teardown();
206  init(ca.capacity());
207  for (const value_type& v : ca) {
208  push_back(v);
209  }
210  }
211 
212  kss::contract::postconditions({
213  KSS_EXPR(_array != nullptr),
214  KSS_EXPR(_capacity >= ca._capacity),
215  KSS_EXPR(*this == ca)
216  });
217  return *this;
218  }
219 
221  if (&ca != this) {
222  teardown();
223  _array = ca._array;
224  _capacity = ca._capacity;
225  _first = ca._first;
226  _last = ca._last;
227  _size = ca._size;
228  _allocator = ca._allocator;
229  ca.teardown();
230  }
231 
232  kss::contract::postconditions({
233  KSS_EXPR(_array != nullptr),
234  KSS_EXPR(_capacity >= _size),
235  KSS_EXPR(_capacity > 0),
236  KSS_EXPR(ca._array == nullptr),
237  KSS_EXPR(ca._capacity == 0),
238  KSS_EXPR(ca._size == 0)
239  });
240  return *this;
241  }
242 
243  template <class InputIterator>
244  void assign(InputIterator first, InputIterator last) {
245  clear();
246  for (InputIterator it = first; it != last; ++it) {
247  ensure_room_for_one_more();
248  push_back(*it);
249  }
250 
251  kss::contract::postconditions({
252  KSS_EXPR(_array != nullptr),
253  KSS_EXPR(_capacity >= _size),
254  KSS_EXPR(_capacity > 0)
255  });
256  }
257 
258  void assign(size_type n, const value_type& val) {
259  clear();
260  reserve(n);
261  for (size_type i = 0; i < n; ++i) {
262  push_back(val);
263  }
264 
265  kss::contract::postconditions({
266  KSS_EXPR(_array != nullptr),
267  KSS_EXPR(_capacity >= _size),
268  KSS_EXPR(_size == n)
269  });
270  }
271 
272  void assign(std::initializer_list<value_type> il) {
273  clear();
274  reserve(il.size());
275  assign(il.begin(), il.end());
276 
277  kss::contract::postconditions({
278  KSS_EXPR(_array != nullptr),
279  KSS_EXPR(_capacity >= _size),
280  KSS_EXPR(_size == il.size())
281  });
282  }
283 
287  iterator begin() { return iterator(*this); }
288  iterator end() { return iterator(*this, true); }
289  const_iterator begin() const { return const_iterator(*this); }
290  const_iterator end() const { return const_iterator(*this, true); }
291  const_iterator cbegin() const { return const_iterator(*this); }
292  const_iterator cend() const { return const_iterator(*this, true); }
293  reverse_iterator rbegin() noexcept { return reverse_iterator(end()); }
294  reverse_iterator rend() noexcept { return reverse_iterator(begin()); }
295  const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); }
296  const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); }
299 
307  size_type size() const noexcept { return _size; }
308  size_type max_size() const noexcept { return _allocator.max_size(); }
309  size_type capacity() const noexcept { return _capacity; }
310  bool empty() const noexcept { return (_size == 0); }
311 
312  void resize(size_type n, const value_type& val = value_type()) {
313  while (size() > n) {
314  pop_back();
315  }
316  if (size() < n) {
317  reserve(n);
318  do { push_back(val); } while (size() < n);
319  }
320 
321  kss::contract::postconditions({
322  KSS_EXPR(_array != nullptr),
323  KSS_EXPR(_size == n),
324  KSS_EXPR(_capacity >= n)
325  });
326  }
327 
328  void reserve(size_type cap) {
329  if (cap <= _capacity) {
330  return;
331  }
332 
333  CircularArray ca(*this, cap, _allocator);
334  swap(ca);
335 
336  kss::contract::postconditions({
337  KSS_EXPR(_array != nullptr),
338  KSS_EXPR(_capacity >= cap),
339  KSS_EXPR(_capacity >= _size)
340  });
341  }
342 
343  void shrink_to_fit() {
344  if (capacity() > size()) {
345  CircularArray tmp(*this, size(), _allocator);
346  swap(tmp);
347  }
348 
349  kss::contract::postconditions({
350  KSS_EXPR(_capacity == _size)
351  });
352  }
353 
360  kss::contract::preconditions({
361  KSS_EXPR(_array != nullptr),
362  KSS_EXPR(_size > n)
363  });
364 
365  size_type pos = _first + n;
366  if (pos >= _capacity) {
367  pos -= _capacity;
368  }
369 
370  // postconditions
371  kss::contract::postconditions({
372  KSS_EXPR((pos >= _first && pos < _capacity)
373  || (pos < _last && _first > _last)
374  || (pos >= _first && pos < _last))
375  });
376  return _array[pos];
377  }
378 
380  kss::contract::preconditions({
381  KSS_EXPR(_array != nullptr),
382  KSS_EXPR(_size > n)
383  });
384 
385  size_type pos = _first + n;
386  if (pos >= _capacity) {
387  pos -= _capacity;
388  }
389 
390  kss::contract::postconditions({
391  KSS_EXPR((pos >= _first && pos < _capacity)
392  || (pos < _last && _first > _last)
393  || (pos >= _first && pos < _last))
394  });
395  return _array[pos];
396  }
397 
399  kss::contract::preconditions({
400  KSS_EXPR(_array != nullptr)
401  });
402 
403  if (n >= _size) {
404  throw std::out_of_range("n is out of range of this circular_array");
405  }
406  size_type pos = _first + n;
407  if (pos >= _capacity) {
408  pos -= _capacity;
409  }
410 
411  kss::contract::postconditions({
412  KSS_EXPR((pos >= _first && pos < _capacity)
413  || (pos < _last && _first > _last)
414  || (pos >= _first && pos < _last))
415  });
416  return _array[pos];
417  }
418 
420  kss::contract::preconditions({
421  KSS_EXPR(_array != nullptr)
422  });
423 
424  if (n >= _size) {
425  throw std::out_of_range("n is out of range of this circular_array");
426  }
427  size_type pos = _first + n;
428  if (pos >= _capacity) {
429  pos -= _capacity;
430  }
431 
432  kss::contract::postconditions({
433  KSS_EXPR((pos >= _first && pos < _capacity)
434  || (pos < _last && _first > _last)
435  || (pos >= _first && pos < _last))
436  });
437  return _array[pos];
438  }
439 
440  reference front() noexcept {
441  kss::contract::preconditions({
442  KSS_EXPR(_array != nullptr),
443  KSS_EXPR(_size > 0)
444  });
445 
446  return _array[_first];
447  }
448 
449  const_reference front() const noexcept {
450  kss::contract::preconditions({
451  KSS_EXPR(_array != nullptr),
452  KSS_EXPR(_size > 0)
453  });
454 
455  return _array[_first];
456  }
457 
458  reference back() noexcept {
459  kss::contract::preconditions({
460  KSS_EXPR(_array != nullptr),
461  KSS_EXPR(_size > 0)
462  });
463 
464  if (_last == 0) {
465  return _array[_capacity-1];
466  }
467  else {
468  return _array[_last - 1];
469  }
470  }
471 
472  const_reference back() const noexcept {
473  kss::contract::preconditions({
474  KSS_EXPR(_array != nullptr),
475  KSS_EXPR(_size > 0)
476  });
477 
478  if (_last == 0) {
479  return _array[_capacity-1];
480  }
481  else {
482  return _array[_last - 1];
483  }
484  }
485 
490  void push_back(const value_type& val) {
491  value_type v(val);
492  push_back(std::move(v));
493 
494  kss::contract::postconditions({
495  KSS_EXPR(back() == val)
496  });
497  }
498 
499  void push_back(value_type&& val) {
500  check_room_for_one_more();
501  _allocator.construct(_array+_last, val);
502  ++_last;
503  ++_size;
504  if (_last >= _capacity) {
505  _last = 0;
506  }
507 
508  kss::contract::postconditions({
509  KSS_EXPR(_array != nullptr),
510  KSS_EXPR(_size > 0),
511  KSS_EXPR(_capacity >= _size)
512  });
513  }
514 
515  void pop_back() noexcept {
516  kss::contract::preconditions({
517  KSS_EXPR(_array != nullptr),
518  KSS_EXPR(_size > 0)
519  });
520 
521  _last = (_last == 0 ? _capacity - 1 : _last - 1);
522  --_size;
523  _allocator.destroy(_array+_last);
524 
525  kss::contract::postconditions({
526  KSS_EXPR(_array != nullptr),
527  KSS_EXPR(_capacity > 0)
528  });
529  }
530 
531  void push_front(const value_type& val) {
532  value_type v(val);
533  push_front(std::move(v));
534 
535  kss::contract::postconditions({
536  KSS_EXPR(front() == val)
537  });
538  }
539 
540  void push_front(value_type&& val) {
541  check_room_for_one_more();
542  _first = (_first == 0 ? _capacity - 1 : _first - 1);
543  ++_size;
544  _allocator.construct(_array+_first, val);
545 
546  kss::contract::postconditions({
547  KSS_EXPR(_array != nullptr),
548  KSS_EXPR(_size > 0),
549  KSS_EXPR(_capacity >= _size)
550  });
551  }
552 
553  void pop_front() noexcept {
554  kss::contract::preconditions({
555  KSS_EXPR(_array != nullptr),
556  KSS_EXPR(_size > 0)
557  });
558 
559  _allocator.destroy(_array+_first);
560  ++_first;
561  --_size;
562  if (_first >= _capacity) {
563  _first = 0;
564  }
565 
566  kss::contract::postconditions({
567  KSS_EXPR(_array != nullptr),
568  KSS_EXPR(_capacity > 0)
569  });
570  }
571 
572  void swap(CircularArray& ca) noexcept {
573  if (&ca != this) {
574  std::swap(_array, ca._array);
575  std::swap(_capacity, ca._capacity);
576  std::swap(_first, ca._first);
577  std::swap(_last, ca._last);
578  std::swap(_size, ca._size);
579  std::swap(_allocator, ca._allocator);
580  }
581  }
582 
583  void clear() noexcept {
585  if (_first < _last) {
586  destroy(_array+_first, _array+_last, _allocator);
587  }
588  else if (_last < _first) {
589  destroy(_array+_first, _array+_capacity, _allocator);
590  destroy(_array, _array+_last, _allocator);
591  }
592  _first = _last = _size = 0;
593 
594  kss::contract::postconditions({
595  KSS_EXPR(_size == 0),
596  KSS_EXPR(_first == 0),
597  KSS_EXPR(_last == 0)
598  });
599  }
600 
604  allocator_type get_allocator() const noexcept { return _allocator; }
605 
610  bool operator==(const CircularArray& rhs) const noexcept {
611  if (&rhs == this) {
612  return true;
613  }
614  if (_size != rhs._size) {
615  return false;
616  }
617  return !kss::util::notEqual(begin(), end(), rhs.begin());
618  }
619 
620  bool operator<(const CircularArray& rhs) const noexcept {
621  if (&rhs == this) {
622  return false;
623  }
624  return std::lexicographical_compare(begin(), end(), rhs.begin(), rhs.end());
625  }
626 
627  private:
628  void init(size_type cap) {
629  _array = _allocator.allocate(cap);
630  _capacity = cap;
631  _first = _last = _size = 0;
632  }
633 
634  void teardown() {
635  if (_array) {
637  if (_first < _last) {
638  destroy(_array+_first, _array+_last, _allocator);
639  }
640  else if (_last < _first) {
641  destroy(_array+_first, _array+_capacity, _allocator);
642  destroy(_array, _array+_last, _allocator);
643  }
644  _allocator.deallocate(_array, _capacity);
645  _array = nullptr;
646  }
647  }
648 
649  void ensure_room_for_one_more() {
650  if (size() == capacity()) {
651  size_type growth = std::max(size_type(10), capacity() / 4);
652  reserve(capacity() + growth);
653  }
654  kss::contract::postconditions({
655  KSS_EXPR(size() < capacity())
656  });
657  }
658 
659  void check_room_for_one_more() {
660  if (size() == capacity()) {
661  throw std::length_error("This circular_array is full.");
662  }
663  kss::contract::postconditions({
664  KSS_EXPR(size() < capacity())
665  });
666  }
667 
668  pointer _array;
669  size_type _capacity;
670  size_type _first;
671  size_type _last; // one past last element
672  size_type _size;
673  allocator_type _allocator;
674  };
675 
679  template <class T, class A>
681  x.swap(y);
682  }
683 }}}
684 
685 #endif
kss::util::containers::CircularArray::operator=
CircularArray & operator=(CircularArray &&ca)
Definition: circular_array.hpp:220
kss::util::containers::CircularArray::CircularArray
CircularArray(CircularArray &&ca)
Definition: circular_array.hpp:156
algorithm.hpp
Miscellaneous algorithms.
kss::util::containers::CircularArray::crend
const_reverse_iterator crend() const noexcept
Definition: circular_array.hpp:298
kss::util::containers::CircularArray::CircularArray
CircularArray(std::initializer_list< value_type > il, size_type cap=size_type(10), const A &allocator=A())
Definition: circular_array.hpp:177
kss::util::containers::CircularArray::empty
bool empty() const noexcept
Definition: circular_array.hpp:310
kss::util::AddRelOps
Add the operators !=, <=, > and >= assuming the existance of == and <.
Definition: add_rel_ops.hpp:31
kss::util::containers::CircularArray::const_pointer
typename A::const_pointer const_pointer
Definition: circular_array.hpp:78
iterator.hpp
Base classes to easily generate custom iterators.
kss::util::containers::CircularArray::reference
typename A::reference reference
Definition: circular_array.hpp:79
kss::util::containers::CircularArray::back
reference back() noexcept
Definition: circular_array.hpp:458
kss::util::containers::swap
void swap(CircularArray< T, A > &x, CircularArray< T, A > &y)
Definition: circular_array.hpp:680
kss::util::containers::CircularArray::swap
void swap(CircularArray &ca) noexcept
Definition: circular_array.hpp:572
kss::util::containers::CircularArray::difference_type
typename A::difference_type difference_type
Definition: circular_array.hpp:72
kss::util::containers::CircularArray::operator==
bool operator==(const CircularArray &rhs) const noexcept
Definition: circular_array.hpp:610
kss::util::containers::CircularArray::push_front
void push_front(const value_type &val)
Definition: circular_array.hpp:531
kss::util::containers::CircularArray::CircularArray
CircularArray(const CircularArray &ca, size_type cap=size_type(10), const A &allocator=A())
Definition: circular_array.hpp:138
kss::util::containers::CircularArray::clear
void clear() noexcept
Definition: circular_array.hpp:583
kss::util::containers::CircularArray::pop_back
void pop_back() noexcept
Definition: circular_array.hpp:515
std::swap
void swap(kss::util::iterators::ForwardIterator< Container, T > &a, kss::util::iterators::ForwardIterator< Container, T > &b)
Definition: iterator.hpp:530
kss::util::containers::CircularArray::CircularArray
CircularArray(size_type cap=size_type(10), const A &allocator=A())
Definition: circular_array.hpp:87
memory.hpp
Miscellaneous algorithms related to memory.
kss::util::iterators::ConstRandomAccessIterator
Base implementation of a const version of a random access iterator.
Definition: iterator.hpp:305
kss::util::containers::CircularArray::value_type
T value_type
Definition: circular_array.hpp:69
kss::util::containers::CircularArray::front
const_reference front() const noexcept
Definition: circular_array.hpp:449
kss::util::containers::CircularArray::const_reverse_iterator
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition: circular_array.hpp:76
kss::util::containers::CircularArray::begin
const_iterator begin() const
Definition: circular_array.hpp:289
kss::util::containers::CircularArray::pointer
typename A::pointer pointer
Definition: circular_array.hpp:77
kss::util::containers::CircularArray::max_size
size_type max_size() const noexcept
Definition: circular_array.hpp:308
kss::util::memory::destroy
void destroy(Iterator start, Iterator finish, Allocator &allocator)
Definition: memory.hpp:38
kss::util::containers::CircularArray::push_back
void push_back(const value_type &val)
Definition: circular_array.hpp:490
kss::util::containers::CircularArray::operator=
CircularArray & operator=(const CircularArray &ca)
Definition: circular_array.hpp:203
kss::util::containers::CircularArray::get_allocator
allocator_type get_allocator() const noexcept
Definition: circular_array.hpp:604
kss::util::containers::CircularArray::pop_front
void pop_front() noexcept
Definition: circular_array.hpp:553
kss::util::containers::CircularArray::end
iterator end()
Definition: circular_array.hpp:288
kss::util::containers::CircularArray
Almost contiguous array referenced in a circular manner.
Definition: circular_array.hpp:67
kss::util::containers::CircularArray::capacity
size_type capacity() const noexcept
Definition: circular_array.hpp:309
kss::util::containers::CircularArray::rend
reverse_iterator rend() noexcept
Definition: circular_array.hpp:294
kss::util::containers::CircularArray::const_reference
typename A::const_reference const_reference
Definition: circular_array.hpp:80
kss::util::containers::CircularArray::end
const_iterator end() const
Definition: circular_array.hpp:290
kss::util::containers::CircularArray::CircularArray
CircularArray(size_type n, const value_type &val, size_type cap=size_type(10), const A &allocator=A())
Definition: circular_array.hpp:101
kss::util::containers::CircularArray::reserve
void reserve(size_type cap)
Definition: circular_array.hpp:328
kss::util::containers::CircularArray::push_front
void push_front(value_type &&val)
Definition: circular_array.hpp:540
kss::util::containers::CircularArray::front
reference front() noexcept
Definition: circular_array.hpp:440
kss::util::containers::CircularArray::assign
void assign(InputIterator first, InputIterator last)
Definition: circular_array.hpp:244
kss::util::containers::CircularArray::const_iterator
kss::util::iterators::ConstRandomAccessIterator< CircularArray > const_iterator
Definition: circular_array.hpp:74
kss::util::containers::CircularArray::rbegin
const_reverse_iterator rbegin() const noexcept
Definition: circular_array.hpp:295
kss::util::containers::CircularArray::back
const_reference back() const noexcept
Definition: circular_array.hpp:472
kss::util::containers::CircularArray::assign
void assign(size_type n, const value_type &val)
Definition: circular_array.hpp:258
kss::util::containers::CircularArray::size_type
typename A::size_type size_type
Definition: circular_array.hpp:71
kss::util::containers::CircularArray::push_back
void push_back(value_type &&val)
Definition: circular_array.hpp:499
kss::util::containers::CircularArray::allocator_type
A allocator_type
Definition: circular_array.hpp:70
kss::util::containers::CircularArray::iterator
kss::util::iterators::RandomAccessIterator< CircularArray > iterator
Definition: circular_array.hpp:73
kss::util::notEqual
bool notEqual(InputIterator first, InputIterator last, InputIterator2 first2, BinaryPredicate bp)
Definition: algorithm.hpp:53
kss::util::containers::CircularArray::cend
const_iterator cend() const
Definition: circular_array.hpp:292
kss::util::containers::CircularArray::assign
void assign(std::initializer_list< value_type > il)
Definition: circular_array.hpp:272
kss::util::containers::CircularArray::at
const_reference at(size_type n) const
Definition: circular_array.hpp:419
kss::util::containers::CircularArray::rbegin
reverse_iterator rbegin() noexcept
Definition: circular_array.hpp:293
kss::util::containers::CircularArray::operator[]
reference operator[](size_type n) noexcept
Definition: circular_array.hpp:359
kss::util::iterators::RandomAccessIterator
Base implementation of a random access iterator.
Definition: iterator.hpp:201
kss::util::containers::CircularArray::size
size_type size() const noexcept
Definition: circular_array.hpp:307
kss::util::containers::CircularArray::crbegin
const_reverse_iterator crbegin() const noexcept
Definition: circular_array.hpp:297
kss::util::containers::CircularArray::~CircularArray
~CircularArray() noexcept
Definition: circular_array.hpp:194
kss::util::containers::CircularArray::reverse_iterator
std::reverse_iterator< iterator > reverse_iterator
Definition: circular_array.hpp:75
kss::util::containers::CircularArray::operator[]
const_reference operator[](size_type n) const noexcept
Definition: circular_array.hpp:379
kss::util::containers::CircularArray::CircularArray
CircularArray(InputIterator first, InputIterator last, size_type cap=size_type(10), const A &allocator=A())
Definition: circular_array.hpp:120
kss::util::containers::CircularArray::begin
iterator begin()
Definition: circular_array.hpp:287
kss::util::containers::CircularArray::at
reference at(size_type n)
Definition: circular_array.hpp:398
kss::util::containers::CircularArray::cbegin
const_iterator cbegin() const
Definition: circular_array.hpp:291
kss
All Klassen Software Solutions libraries begin with this namespace.
Definition: add_rel_ops.hpp:19
kss::util::containers::CircularArray::resize
void resize(size_type n, const value_type &val=value_type())
Definition: circular_array.hpp:312
kss::util::containers::CircularArray::shrink_to_fit
void shrink_to_fit()
Definition: circular_array.hpp:343
kss::util::containers::CircularArray::operator<
bool operator<(const CircularArray &rhs) const noexcept
Definition: circular_array.hpp:620
kss::util::containers::CircularArray::rend
const_reverse_iterator rend() const noexcept
Definition: circular_array.hpp:296