101 using value_type = T;
107 using const_pointer =
const T*;
113 using const_iterator =
const T*;
118 using reference = T&;
119 using const_reference =
const T&;
134 requires (default_initializable<T>);
135 InlineBuffer (
size_t nElements, Common::ArgByValueType<T> fillValue);
136 InlineBuffer (UninitializedConstructorFlag flag,
size_t nElements);
137 template <
size_t FROM_BUF_SIZE>
141 template <input_iterator ITERATOR_OF_T, sentinel_for<remove_cvref_t<ITERATOR_OF_T>> ITERATOR_OF_T2>
142 InlineBuffer (const ITERATOR_OF_T& start, ITERATOR_OF_T2&& end);
153 nonvirtual
InlineBuffer& operator= (const SPAN_T& copyFrom);
161 nonvirtual explicit operator const T*() const noexcept;
162 nonvirtual explicit operator T*() noexcept;
169 nonvirtual pointer
data () noexcept;
170 nonvirtual const_pointer
data () const noexcept;
175 nonvirtual iterator begin () noexcept;
176 nonvirtual const_iterator begin () const noexcept;
181 nonvirtual iterator end () noexcept;
182 nonvirtual const_iterator end () const noexcept;
188 nonvirtual reference
at (
size_t i) noexcept;
189 nonvirtual const_reference
at (
size_t i) const noexcept;
195 nonvirtual reference operator[] (
size_t i) noexcept;
196 nonvirtual const_reference operator[] (
size_t i) const noexcept;
205 constexpr
size_t capacity () const noexcept;
222 nonvirtual
void reserve (
size_t newCapacity,
bool atLeast = true);
225 [[deprecated ("Since Stroika v3.0d1, just use
reserve with atLeast flag=true)")]]
void ReserveAtLeast (
size_t newCapacityAtLeast)
227 reserve (newCapacityAtLeast,
true);
236 nonvirtual
size_t GetSize () const noexcept;
247 nonvirtual
size_t size () const noexcept;
253 nonvirtual
bool empty () const noexcept;
268 nonvirtual
void resize (
size_t nElements)
269 requires (default_initializable<T>);
270 nonvirtual
void resize (
size_t nElements, Common::ArgByValueType<T> fillValue);
280 requires (is_trivially_copyable_v<T> and is_trivially_destructible_v<T>);
288 nonvirtual
void ShrinkTo (
size_t nElements);
298 requires (default_initializable<T>);
305 nonvirtual
void GrowToSize (
size_t nElements, Common::ArgByValueType<T> fillValue);
315 requires (is_trivially_copyable_v<T>);
321 nonvirtual
void Insert (
size_t at, const SPAN_T& copyFrom);
322 nonvirtual
void Insert (
size_t at, const T& item);
328 nonvirtual
void insert (iterator i, const_pointer from, const_pointer to);
338 nonvirtual
void push_back (Common::ArgByValueType<T> e);
340 nonvirtual
void push_back (const SPAN_T& copyFrom);
346 template <
ISpan SPAN_T>
359 nonvirtual
void Remove (
size_t from,
size_t to);
364 nonvirtual
void clear () noexcept;
366#if qStroika_Foundation_Debug_AssertionsChecked
368 static constexpr byte kGuard1_[8] = {
369 0x45_b, 0x23_b, 0x12_b, 0x56_b, 0x99_b, 0x76_b, 0x12_b, 0x55_b,
371 static constexpr byte kGuard2_[8] = {
372 0x15_b, 0x32_b, 0xa5_b, 0x16_b, 0x11_b, 0x7a_b, 0x90_b, 0x10_b,
378 static constexpr size_t SizeInBytes_ (
size_t nElts)
noexcept
383 return sizeof (T[1]) * nElts;
387 nonvirtual
byte* LiveDataAsAllocatedBytes_ () noexcept;
390 static
byte* Allocate_ (
size_t bytes);
393 static
void Deallocate_ (
byte* bytes) noexcept;
396 static
byte* Reallocate_ (
byte* bytes,
size_t n)
397 requires (is_trivially_copyable_v<T>);
401#if qStroika_Foundation_Debug_AssertionsChecked
402 byte fGuard1_[
sizeof (kGuard1_)];
404 DISABLE_COMPILER_MSC_WARNING_START (4324)
406 size_t fCapacityOfFreeStoreAllocation_;
407 alignas (T)
byte fInlinePreallocatedBuffer_[SizeInBytes_ (BUF_SIZE)];
409 DISABLE_COMPILER_MSC_WARNING_END (4324)
411#if qStroika_Foundation_Debug_AssertionsChecked
412 byte fGuard2_[
sizeof (kGuard2_)];
418 constexpr bool HasEnoughCapacity_ (
size_t sz)
const
422 if (sz <= BUF_SIZE) [[likely]] {
429 constexpr bool UsingInlinePreallocatedBuffer_ () const noexcept;
432 nonvirtual
void Invariant () const noexcept;
435#if qStroika_Foundation_Debug_AssertionsChecked
436 nonvirtual
void Invariant_ () const noexcept;
437 nonvirtual
void ValidateGuards_ () const noexcept;
441 constexpr T* BufferAsT_ () noexcept;
442 constexpr const T* BufferAsT_ () const noexcept;
445 static
void DestroyElts_ (T* start, T* end) noexcept;