SWC-DB  v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
Vector.h
Go to the documentation of this file.
1 /*
2  * SWC-DB© Copyright since 2019 Alex Kashirin <kashirin.alex@gmail.com>
3  * License details at <https://github.com/kashirin-alex/swc-db/#license>
4  */
5 
6 #ifndef swcdb_core_Vector_h
7 #define swcdb_core_Vector_h
8 
9 
10 
11 namespace SWC { namespace Core {
12 
13 template<typename T, typename SizeT=uint32_t, SizeT GROW_SZ=0>
14 class Vector {
15 
16  constexpr static bool _Requires_Costructor
17  = std::is_const_v<T> ||
18  !(std::is_pointer_v<T> ||
19  std::is_integral_v<T> ||
20  (std::is_reference_v<T> &&
21  !std::is_const_v<std::remove_reference_t<const T&>>) );
22 
23  constexpr static bool _Requires_Destructor
24  = !(std::is_pointer_v<T> ||
25  std::is_integral_v<T> ||
26  std::is_reference_v<T> ||
27  std::is_trivially_destructible_v<T> );
28 
29  constexpr static bool _NoExceptCopy
30  = std::is_nothrow_constructible_v<T, const T&>;
31 
32  constexpr static bool _NoExceptMove
33  = std::is_nothrow_constructible_v<T, T&&>;
34 
35  constexpr static bool _NoExceptMoveAssign
36  = std::is_nothrow_move_assignable_v<T>;
37 
38  constexpr static bool _NoExceptDestructor
39  = std::is_nothrow_destructible_v<T>;
40 
41 
42  public:
43 
44  using value_type = T;
45  using size_type = SizeT;
46 
47  typedef value_type* pointer;
48  typedef const value_type* const_pointer;
49 
50  typedef value_type* iterator;
51  typedef const value_type* const_iterator;
52 
54  typedef const value_type& const_reference;
55 
56 
57  constexpr SWC_CAN_INLINE
58  static size_type max_size() noexcept {
59  return size_type(0) - size_type(1);
60  }
61  static_assert(max_size() > 0, "SWC-DB Vector supports only unsigned size!");
62 
63 
64  constexpr SWC_CAN_INLINE
65  Vector() noexcept : _data(nullptr), _cap(0), _size(0) { }
66 
67  template<typename... ArgsT>
69  Vector(size_type sz, ArgsT&&... args)
70  : _data(sz ? _allocate(sz, std::forward<ArgsT>(args)...) : nullptr),
71  _cap(sz), _size(sz) {
72  }
73 
74  constexpr SWC_CAN_INLINE
75  Vector(Vector&& other) noexcept
76  : _data(other._data), _cap(other._cap), _size(other._size) {
77  other._data = nullptr;
78  other._cap = other._size = 0;
79  }
80 
82  Vector(const Vector& other)
83  : _data(
84  other._size
85  ? _copy(
87  other._data, other._size
88  )
89  : nullptr
90  ),
91  _cap(other._size), _size(other._size) {
92  }
93 
96  : _data(nullptr), _cap(0), _size(0) {
97  assign(_b, _e);
98  }
99 
101  Vector(std::initializer_list<value_type>&& l)
102  : _data(l.size() ? _allocate_uinitialized(l.size()) : nullptr),
103  _cap(l.size()), _size(_cap) {
104  for(size_type i = 0; i < _size; ++i)
105  _construct(_data + i, std::move(*(l.begin() + i)));
106  }
107 
110  if(_data) {
112  for(auto& it : *this)
113  it.~value_type();
114  }
116  }
117  }
118 
120  void clear() noexcept(_NoExceptDestructor) {
122  for(pointer ptr = _data; _size; --_size, ++ptr)
123  ptr->~value_type();
124  } else {
125  _size = 0;
126  }
127  }
128 
130  void free() noexcept {
131  if(_data) {
132  clear();
134  _data = nullptr;
135  _cap = 0;
136  }
137  }
138 
139 
141  Vector& operator=(Vector&& other) noexcept {
142  free();
143  _data = other._data;
144  _cap = other._cap;
145  _size = other._size;
146  other._data = nullptr;
147  other._cap = other._size = 0;
148  return *this;
149  }
150 
152  Vector& operator=(const Vector& other) {
153  free();
154  if((_cap = _size = other._size)) {
156  }
157  return *this;
158  }
159 
161  void swap(Vector& other) noexcept {
162  std::swap(_data, other._data);
163  std::swap(_cap, other._cap);
164  std::swap(_size, other._size);
165  }
166 
167  constexpr SWC_CAN_INLINE
168  bool empty() const noexcept {
169  return !_size;
170  }
171 
172  constexpr SWC_CAN_INLINE
173  bool operator==(const Vector& other) const noexcept {
174  if(_size != other.size())
175  return false;
176  for(size_type i = 0; i < _size; ++i) {
177  if((*this)[i] != other[i])
178  return false;
179  }
180  return true;
181  }
182 
183  constexpr SWC_CAN_INLINE
184  bool operator!=(const Vector& other) const noexcept {
185  return !(*this == other);
186  }
187 
188  constexpr SWC_CAN_INLINE
189  size_type size() const noexcept {
190  return _size;
191  }
192 
193  constexpr SWC_CAN_INLINE
194  size_type capacity() const noexcept {
195  return _cap;
196  }
197 
198 
199  constexpr SWC_CAN_INLINE
200  pointer data() noexcept {
201  return _data;
202  }
203 
204  constexpr SWC_CAN_INLINE
205  const_pointer data() const noexcept {
206  return _data;
207  }
208 
209 
210  constexpr SWC_CAN_INLINE
211  iterator begin() noexcept {
212  return _data;
213  }
214 
215  constexpr SWC_CAN_INLINE
216  const_iterator cbegin() const noexcept {
217  return _data;
218  }
219 
220  constexpr SWC_CAN_INLINE
221  const_iterator begin() const noexcept {
222  return cbegin();
223  }
224 
225 
226  constexpr SWC_CAN_INLINE
227  iterator end() noexcept {
228  return _data + _size;
229  }
230 
231  constexpr SWC_CAN_INLINE
232  const_iterator cend() const noexcept {
233  return _data + _size;
234  }
235 
236  constexpr SWC_CAN_INLINE
237  const_iterator end() const noexcept {
238  return cend();
239  }
240 
241 
242  constexpr SWC_CAN_INLINE
243  reference front() noexcept {
244  return *_data;
245  }
246 
247  constexpr SWC_CAN_INLINE
248  const_reference front() const noexcept {
249  return *_data;
250  }
251 
252 
253  constexpr SWC_CAN_INLINE
254  reference back() noexcept {
255  return _data[_size - 1];
256  }
257 
258  constexpr SWC_CAN_INLINE
259  const_reference back() const noexcept {
260  return _data[_size - 1];
261  }
262 
263 
264  constexpr SWC_CAN_INLINE
266  return _data[pos];
267  }
268 
269  constexpr SWC_CAN_INLINE
270  const_reference operator[](size_type pos) const noexcept {
271  return _data[pos];
272  }
273 
274 
277  if(_cap > sz || _cap > _size) {
278  if(_size) {
279  _cap = sz > _size ? sz : _size;
281  } else {
282  free();
283  }
284  }
285  }
286 
288  void reserve(size_type cap) {
289  if(_cap < cap)
290  _grow(cap - _cap);
291  }
292 
294  void reserve() {
295  if(_cap == _size) {
296  if(_size) {
297  size_type remain = max_size() - _cap;
298  _grow(GROW_SZ ? (GROW_SZ < remain ? GROW_SZ : remain)
299  : (_size < remain ? _size : remain));
300  } else {
301  _grow(1);
302  }
303  }
304  }
305 
306  template<typename... ArgsT>
308  void resize(size_type sz, ArgsT&&... args) {
309  if(sz > _size) {
310  reserve(sz);
311  if(_Requires_Costructor || sizeof...(args) > 0) {
312  for(pointer ptr = _data + _size; _size < sz; ++_size, ++ptr) {
313  _construct(ptr, std::forward<ArgsT>(args)...);
314  }
315  } else {
316  _size = sz;
317  }
318  } else if(sz < _size) {
320  for(pointer ptr = _data + sz; sz < _size; --_size, ++ptr)
321  ptr->~value_type();
322  } else {
323  _size = sz;
324  }
325  }
326  }
327 
328 
329  template<typename... ArgsT>
331  void push_back(ArgsT&&... args) {
332  //if(max_size() == _size)
333  // throw std::out_of_range("Reached size_type limit!");
334  reserve();
335  push_back_unsafe(std::forward<ArgsT>(args)...);
336  }
337 
338  template<typename... ArgsT>
340  void push_back_unsafe(ArgsT&&... args)
341  noexcept(std::is_nothrow_constructible_v<value_type, ArgsT...>) {
342  _construct(_data + _size, std::forward<ArgsT>(args)...);
343  ++_size;
344  }
345 
346 
347  template<typename... ArgsT>
349  reference emplace_back(ArgsT&&... args) {
350  //if(max_size() == _size)
351  // throw std::out_of_range("Reached size_type limit!");
352  reserve();
353  return emplace_back_unsafe(std::forward<ArgsT>(args)...);
354  }
355  template<typename... ArgsT>
358  noexcept(std::is_nothrow_constructible_v<value_type, ArgsT...>) {
359  reference ref = *_construct(_data + _size, std::forward<ArgsT>(args)...);
360  ++_size;
361  return ref;
362  }
363 
364 
365  template<typename... ArgsT>
367  iterator insert(size_type offset, ArgsT&&... args) {
368  if(offset >= _size)
369  return &emplace_back(std::forward<ArgsT>(args)...);
370 
371  if(_cap == _size) {
372  if(max_size() == _cap)
373  throw std::out_of_range("Reached size_type limit!");
375  _data, _size, offset, ++_cap, std::forward<ArgsT>(args)...);
376  } else {
377  _construct(
378  _alter(_data + offset, _size - offset, 1),
379  std::forward<ArgsT>(args)...);
380  }
381  ++_size;
382  return _data + offset;
383  }
384 
385  template<typename... ArgsT>
387  iterator insert(const_iterator it, ArgsT&&... args) {
388  return insert(it - _data, std::forward<ArgsT>(args)...);
389  }
390 
391  template<typename... ArgsT>
393  reference emplace(const_iterator it, ArgsT&&... args) {
394  return *insert(it, std::forward<ArgsT>(args)...);
395  }
396 
397  template<typename... ArgsT>
400  ArgsT&&... args)
401  noexcept(_NoExceptMove && _NoExceptDestructor &&
402  std::is_nothrow_constructible_v<value_type, ArgsT...>) {
403  size_type offset = it - _data;
404  return offset >= _size
405  ? &emplace_back_unsafe(std::forward<ArgsT>(args)...)
406  : _construct(
407  _alter(_data + offset, (_size++) - offset, 1),
408  std::forward<ArgsT>(args)...);
409  }
410 
411 
414  const_iterator first, const_iterator last) {
415  if(first == last)
416  return _data + offset;
417 
418  size_type sz = last - first;
419  size_type remain = _cap - _size;
420  if(sz > remain) {
421  if(max_size() - _size < sz)
422  throw std::out_of_range("Reached size_type limit!");
423  if(_size) {
424  _cap += sz - remain;
425  _data = _allocate_insert(_data, _size, offset, _cap, first, last);
426  _size += sz;
427  return _data + offset;
428  }
429  _grow(sz - remain);
430  }
431  pointer data_offset = _size
432  ? (_size > offset
433  ? _alter(_data + offset, _size - offset, sz)
434  : _data + offset)
435  : _data;
436  _size += sz;
437  pointer ptr = data_offset;
438  for(size_type i=0; i<sz; ++ptr, ++i)
439  _construct(ptr, first[i]);
440  return data_offset;
441  }
442 
445  const_iterator first, const_iterator last) {
446  return insert(it - _data, first, last);
447  }
448 
449 
450  template<typename IteratorT>
452  void assign(IteratorT first, IteratorT last) {
453  clear();
454  if(size_type sz = last - first) {
455  reserve(sz);
456  _size = sz;
457  for(size_type i = 0; i < sz; ++i)
458  _construct(_data + i, first[i]);
459  }
460  }
461 
462 
466  if(offset >= _size)
467  return end();
468 
469  --_size;
470  pointer ptr = _data + offset;
471  for(size_type remain= _size - offset; remain; --remain, ++ptr) {
472  *ptr = std::move(*(ptr + 1));
473  }
475  ptr->~value_type();
476  return _data + offset;
477  }
478 
482  return erase(it - _data);
483  }
484 
487  const_iterator last)
489  size_type offset = first - _data;
490  if(offset >= _size)
491  return end();
492 
493  size_type amt = last - first;
494  _size -= amt;
495  pointer ptr = _data + offset;
496  for(size_type remain = _size - offset; remain; --remain, ++ptr) {
497  *ptr = std::move(*(ptr + amt));
498  }
499  if(_Requires_Destructor) for(; ptr != last; ++ptr) {
500  ptr->~value_type();
501  }
502  return _data + offset;
503  }
504 
506  void pop_back() noexcept(_NoExceptDestructor) {
507  if(_size) {
508  --_size;
510  (_data + _size)->~value_type();
511  }
512  }
513 
514  private:
515 
517  void _grow(size_type sz) {
518  if(sz && (_cap += sz))
520  }
521 
524  return static_cast<pointer>(::operator new(
525  sizeof(value_type) * size,
526  std::align_val_t(std::alignment_of<value_type>::value)
527  ));
528  }
529 
530  /* IF can grow in-place
531  SWC_CAN_INLINE
532  static pointer _allocate_uinitialized(pointer data_prev, size_t data_prev,
533  size_type size) {
534  pointer data = _allocate_uinitialized(size, data_prev);
535  if(data != data_prev) {
536  _move(data, data_prev, size_prev);
537  _deallocate(data_prev, size_prev);
538  }
539  return data;
540  */
541 
543  static pointer _allocate_uinitialized(pointer data_prev, size_t size_prev,
544  size_type sz) {
545  pointer data = _move(_allocate_uinitialized(sz), data_prev, size_prev);
546  _deallocate(data_prev, size_prev);
547  return data;
548  }
549 
550  template<typename... ArgsT>
552  static pointer _allocate_insert(pointer data_prev, size_type size_prev,
553  size_type offset, size_type size,
554  ArgsT&&... args) {
555  if(offset == size)
556  throw std::out_of_range("Offset above size_type limit!");
558  pointer ptr = data;
559  pointer ptr_prev = data_prev;
560  size_type i = 0;
561  for(; i < offset; ++ptr, ++ptr_prev, ++i) {
562  _construct(ptr, std::move(*ptr_prev));
564  ptr_prev->~value_type();
565  }
566  _construct(ptr++, std::forward<ArgsT>(args)...);
567 
568  for(; i < size_prev; ++i, ++ptr, ++ptr_prev) {
569  _construct(ptr, std::move(*ptr_prev));
571  ptr_prev->~value_type();
572  }
573  _deallocate(data_prev, size_prev);
574  return data;
575  }
576 
578  static pointer _allocate_insert(pointer data_prev, size_type size_prev,
579  size_type offset, size_type size,
580  const_iterator first, const_iterator last) {
581  //if(offset >= size)
582  // throw std::out_of_range("Reached size_type limit!");
584  pointer ptr = data;
585  pointer ptr_prev = data_prev;
586  size_type i = 0;
587  for(; i < offset; ++ptr, ++ptr_prev, ++i) {
588  _construct(ptr, std::move(*ptr_prev));
590  ptr_prev->~value_type();
591  }
592  for(iterator it=const_cast<iterator>(first); it != last; ++ptr, ++it) {
593  _construct(ptr, *it);
594  }
595  for(; i < size_prev; ++i, ++ptr, ++ptr_prev) {
596  _construct(ptr, std::move(*ptr_prev));
598  ptr_prev->~value_type();
599  }
600  _deallocate(data_prev, size_prev);
601  return data;
602  }
603 
605  static void _deallocate(pointer data, size_t) noexcept {
606  ::operator delete(
607  data,
608  std::align_val_t(std::alignment_of<value_type>::value)
609  );
610  }
611 
612 
613  template<typename... ArgsT>
615  static pointer _allocate(size_type sz, ArgsT&&... args) {
617  if(_Requires_Costructor || sizeof...(args) > 0) {
618  for(pointer ptr = data; sz; --sz, ++ptr)
619  _construct(ptr, std::forward<ArgsT>(args)...);
620  }
621  //std::uninitialized_default_construct(data, data + sz);
622  return data;
623  }
624 
625 
626  template<typename... ArgsT>
628  static pointer _construct(pointer ptr, ArgsT&&... args)
629  noexcept(std::is_nothrow_constructible_v<value_type, ArgsT...>) {
630  if(_Requires_Costructor || sizeof...(args) > 0)
631  new (ptr) value_type(std::forward<ArgsT>(args)...);
632  return ptr;
633  }
634 
635 
638  const_pointer data_prev,
639  size_type size_prev) noexcept(_NoExceptCopy) {
640  for(pointer ptr=data; size_prev; --size_prev, ++ptr, ++data_prev)
641  _construct(ptr, *data_prev);
642  //std::uninitialized_copy_n(data_prev, size_prev, data);
643  return data;
644  }
645 
648  pointer data_prev,
649  size_type size_prev)
650  noexcept(_NoExceptMove && _NoExceptDestructor) {
651  for(pointer ptr=data; size_prev; --size_prev, ++ptr, ++data_prev) {
652  _construct(ptr, std::move(*data_prev));
654  data_prev->~value_type();
655  }
656  //std::uninitialized_move_n(data_prev, size_prev, data);
657  return data;
658  }
659 
662  size_type amount)
663  noexcept(_NoExceptMove && _NoExceptDestructor) {
664  pointer prev = data + remain - 1;
665  for(pointer ptr = prev + amount; remain; --remain, --ptr, --prev) {
666  _construct(ptr, std::move(*prev));
668  prev->~value_type();
669  }
670  return data;
671  }
672 
673 
677 
678 
679  /*
680  template<typename vT>
681  SWC_CAN_INLINE
682  T* find(const vT& value) {
683  for(auto it=Get<Iterator>(value); it; ++it) {
684  if(value == *it.item)
685  return &*it.item;
686  }
687  return nullptr;
688  }
689 
690  template<typename vT>
691  SWC_CAN_INLINE
692  const T* cfind(const vT& value) {
693  for(auto it=Get<ConstIterator>(value); it; ++it) {
694  if(value == *it.item)
695  return &*it.item;
696  }
697  return nullptr;
698  }
699  */
700 
701 };
702 
703 
704 }} // namespace SWC::Core
705 
706 
707 
708 #endif // swcdb_core_Vector_h
SWC::Core::Vector::erase
SWC_CAN_INLINE iterator erase(size_type offset) noexcept(_NoExceptMoveAssign &&_NoExceptDestructor)
Definition: Vector.h:464
SWC::Core::Vector::front
constexpr SWC_CAN_INLINE reference front() noexcept
Definition: Vector.h:243
SWC::Core::Vector::_NoExceptMoveAssign
constexpr static bool _NoExceptMoveAssign
Definition: Vector.h:36
SWC::Core::Vector::end
constexpr SWC_CAN_INLINE const_iterator end() const noexcept
Definition: Vector.h:237
SWC::Core::Vector::resize
SWC_CAN_INLINE void resize(size_type sz, ArgsT &&... args)
Definition: Vector.h:308
SWC::Core::Vector::begin
constexpr SWC_CAN_INLINE const_iterator begin() const noexcept
Definition: Vector.h:221
SWC::Core::Vector::clear
SWC_CAN_INLINE void clear() noexcept(_NoExceptDestructor)
Definition: Vector.h:120
SWC::Core::Vector::reference
value_type & reference
Definition: Vector.h:53
SWC::Core::Vector::iterator
value_type * iterator
Definition: Vector.h:50
SWC::Core::Vector::operator=
SWC_CAN_INLINE Vector & operator=(Vector &&other) noexcept
Definition: Vector.h:141
SWC::Core::Vector::capacity
constexpr SWC_CAN_INLINE size_type capacity() const noexcept
Definition: Vector.h:194
SWC::Core::Vector::_move
static SWC_CAN_INLINE pointer _move(pointer data, pointer data_prev, size_type size_prev) noexcept(_NoExceptMove &&_NoExceptDestructor)
Definition: Vector.h:647
SWC::Core::Vector::_alter
static SWC_CAN_INLINE pointer _alter(pointer data, size_type remain, size_type amount) noexcept(_NoExceptMove &&_NoExceptDestructor)
Definition: Vector.h:661
SWC::Core::Vector::pointer
value_type * pointer
Definition: Vector.h:47
SWC::Core::Vector::const_iterator
const value_type * const_iterator
Definition: Vector.h:51
SWC::Core::Vector::Vector
constexpr SWC_CAN_INLINE Vector(Vector &&other) noexcept
Definition: Vector.h:75
SWC::Core::Vector::data
constexpr SWC_CAN_INLINE const_pointer data() const noexcept
Definition: Vector.h:205
SWC::Core::Vector::~Vector
SWC_CAN_INLINE ~Vector() noexcept(_NoExceptDestructor)
Definition: Vector.h:109
SWC::Core::Vector< Value >::size_type
uint32_t size_type
Definition: Vector.h:45
SWC::Core::Vector::Vector
SWC_CAN_INLINE Vector(size_type sz, ArgsT &&... args)
Definition: Vector.h:69
SWC::Core::Vector::Vector
constexpr SWC_CAN_INLINE Vector() noexcept
Definition: Vector.h:65
SWC::Core::Vector::emplace
SWC_CAN_INLINE reference emplace(const_iterator it, ArgsT &&... args)
Definition: Vector.h:393
SWC::Core::Vector::insert
SWC_CAN_INLINE iterator insert(const_iterator it, const_iterator first, const_iterator last)
Definition: Vector.h:444
SWC::Core::Vector::_copy
static SWC_CAN_INLINE pointer _copy(pointer data, const_pointer data_prev, size_type size_prev) noexcept(_NoExceptCopy)
Definition: Vector.h:637
SWC::Core::Vector::_allocate_insert
static SWC_CAN_INLINE pointer _allocate_insert(pointer data_prev, size_type size_prev, size_type offset, size_type size, ArgsT &&... args)
Definition: Vector.h:552
SWC::Core::Vector< Value >::value_type
Value value_type
Definition: Vector.h:44
SWC::Core::Vector::insert_unsafe
SWC_CAN_INLINE iterator insert_unsafe(const_iterator it, ArgsT &&... args) noexcept(_NoExceptMove &&_NoExceptDestructor &&std::is_nothrow_constructible_v< value_type, ArgsT... >)
Definition: Vector.h:399
SWC::Core::Vector::empty
constexpr SWC_CAN_INLINE bool empty() const noexcept
Definition: Vector.h:168
SWC::Core::Vector::pop_back
SWC_CAN_INLINE void pop_back() noexcept(_NoExceptDestructor)
Definition: Vector.h:506
SWC_CAN_INLINE
#define SWC_CAN_INLINE
Definition: Compat.h:102
SWC::Core::Vector::back
constexpr SWC_CAN_INLINE reference back() noexcept
Definition: Vector.h:254
SWC::Core::Vector::end
constexpr SWC_CAN_INLINE iterator end() noexcept
Definition: Vector.h:227
SWC
The SWC-DB C++ namespace 'SWC'.
Definition: main.cc:12
SWC::Core::Vector::push_back_unsafe
SWC_CAN_INLINE void push_back_unsafe(ArgsT &&... args) noexcept(std::is_nothrow_constructible_v< value_type, ArgsT... >)
Definition: Vector.h:340
SWC::Core::Vector::_NoExceptMove
constexpr static bool _NoExceptMove
Definition: Vector.h:33
SWC::Core::Vector::_Requires_Costructor
constexpr static bool _Requires_Costructor
Definition: Vector.h:17
SWC::Core::Vector::erase
SWC_CAN_INLINE iterator erase(const_iterator it) noexcept(_NoExceptMoveAssign &&_NoExceptDestructor)
Definition: Vector.h:480
SWC::Core::Vector::_cap
size_type _cap
Definition: Vector.h:675
SWC::Core::Vector::_grow
SWC_CAN_INLINE void _grow(size_type sz)
Definition: Vector.h:517
SWC::Core::Vector::const_pointer
const value_type * const_pointer
Definition: Vector.h:48
SWC::Core::Vector::operator==
constexpr SWC_CAN_INLINE bool operator==(const Vector &other) const noexcept
Definition: Vector.h:173
SWC::Core::Vector::Vector
SWC_CAN_INLINE Vector(const Vector &other)
Definition: Vector.h:82
SWC::Core::Vector::swap
SWC_CAN_INLINE void swap(Vector &other) noexcept
Definition: Vector.h:161
SWC::Core::Vector::Vector
SWC_CAN_INLINE Vector(std::initializer_list< value_type > &&l)
Definition: Vector.h:101
SWC::Core::Vector::_construct
static SWC_CAN_INLINE pointer _construct(pointer ptr, ArgsT &&... args) noexcept(std::is_nothrow_constructible_v< value_type, ArgsT... >)
Definition: Vector.h:628
SWC::Core::Vector::free
SWC_CAN_INLINE void free() noexcept
Definition: Vector.h:130
SWC::Core::Vector::data
constexpr SWC_CAN_INLINE pointer data() noexcept
Definition: Vector.h:200
SWC::Core::Vector::shrink_to_fit
SWC_CAN_INLINE void shrink_to_fit(size_type sz=0)
Definition: Vector.h:276
SWC::Core::Vector::max_size
constexpr static SWC_CAN_INLINE size_type max_size() noexcept
Definition: Vector.h:58
SWC::Core::Vector
Definition: Vector.h:14
SWC::Core::Vector::_allocate_uinitialized
static SWC_CAN_INLINE pointer _allocate_uinitialized(pointer data_prev, size_t size_prev, size_type sz)
Definition: Vector.h:543
SWC::Core::Vector::_allocate_insert
static SWC_CAN_INLINE pointer _allocate_insert(pointer data_prev, size_type size_prev, size_type offset, size_type size, const_iterator first, const_iterator last)
Definition: Vector.h:578
SWC::Core::Vector::emplace_back_unsafe
SWC_CAN_INLINE reference emplace_back_unsafe(ArgsT &&... args) noexcept(std::is_nothrow_constructible_v< value_type, ArgsT... >)
Definition: Vector.h:357
SWC::Core::Vector::reserve
SWC_CAN_INLINE void reserve()
Definition: Vector.h:294
SWC::Config::T
const uint64_t T
Definition: Property.h:27
SWC::Core::Vector::insert
SWC_CAN_INLINE iterator insert(size_type offset, const_iterator first, const_iterator last)
Definition: Vector.h:413
SWC::Core::Vector::cend
constexpr SWC_CAN_INLINE const_iterator cend() const noexcept
Definition: Vector.h:232
SWC::Core::Vector::Vector
SWC_CAN_INLINE Vector(const_iterator _b, const_iterator _e)
Definition: Vector.h:95
SWC::Core::Vector::insert
SWC_CAN_INLINE iterator insert(const_iterator it, ArgsT &&... args)
Definition: Vector.h:387
SWC::Core::Vector::operator[]
constexpr SWC_CAN_INLINE const_reference operator[](size_type pos) const noexcept
Definition: Vector.h:270
SWC::Core::Vector::_Requires_Destructor
constexpr static bool _Requires_Destructor
Definition: Vector.h:24
SWC::Core::Vector::_allocate
static SWC_CAN_INLINE pointer _allocate(size_type sz, ArgsT &&... args)
Definition: Vector.h:615
SWC::Core::Vector::back
constexpr SWC_CAN_INLINE const_reference back() const noexcept
Definition: Vector.h:259
SWC::Core::Vector::erase
SWC_CAN_INLINE iterator erase(const_iterator first, const_iterator last) noexcept(_NoExceptMoveAssign &&_NoExceptDestructor)
Definition: Vector.h:486
SWC::Core::Vector::_data
pointer _data
Definition: Vector.h:674
SWC::Core::Vector::operator!=
constexpr SWC_CAN_INLINE bool operator!=(const Vector &other) const noexcept
Definition: Vector.h:184
SWC::Core::Vector::assign
SWC_CAN_INLINE void assign(IteratorT first, IteratorT last)
Definition: Vector.h:452
SWC::Core::Vector::_size
size_type _size
Definition: Vector.h:676
SWC::Core::Vector::const_reference
const value_type & const_reference
Definition: Vector.h:54
SWC::Core::Vector::push_back
SWC_CAN_INLINE void push_back(ArgsT &&... args)
Definition: Vector.h:331
SWC::Core::Vector::cbegin
constexpr SWC_CAN_INLINE const_iterator cbegin() const noexcept
Definition: Vector.h:216
SWC::Core::Vector::_allocate_uinitialized
static SWC_CAN_INLINE pointer _allocate_uinitialized(size_type size)
Definition: Vector.h:523
SWC::Core::Vector::size
constexpr SWC_CAN_INLINE size_type size() const noexcept
Definition: Vector.h:189
SWC::Core::Vector::_NoExceptCopy
constexpr static bool _NoExceptCopy
Definition: Vector.h:30
SWC::Core::Vector::emplace_back
SWC_CAN_INLINE reference emplace_back(ArgsT &&... args)
Definition: Vector.h:349
SWC::Core::Vector::insert
SWC_CAN_INLINE iterator insert(size_type offset, ArgsT &&... args)
Definition: Vector.h:367
SWC::Core::Vector::_deallocate
static SWC_CAN_INLINE void _deallocate(pointer data, size_t) noexcept
Definition: Vector.h:605
SWC::Core::Vector::_NoExceptDestructor
constexpr static bool _NoExceptDestructor
Definition: Vector.h:39
SWC::Core::Vector::reserve
SWC_CAN_INLINE void reserve(size_type cap)
Definition: Vector.h:288
SWC::Core::Vector::operator=
SWC_CAN_INLINE Vector & operator=(const Vector &other)
Definition: Vector.h:152
SWC::Core::Vector::front
constexpr SWC_CAN_INLINE const_reference front() const noexcept
Definition: Vector.h:248
SWC::Core::Vector::operator[]
constexpr SWC_CAN_INLINE reference operator[](size_type pos) noexcept
Definition: Vector.h:265
SWC::Core::Vector::begin
constexpr SWC_CAN_INLINE iterator begin() noexcept
Definition: Vector.h:211