100 using const_pointer =
const T*;
106 using const_iterator =
const T*;
111 using reference = T&;
112 using const_reference =
const T&;
127 InlineBuffer (UninitializedConstructorFlag flag,
size_t nElements);
128 template <
size_t FROM_BUF_SIZE>
132 template <input_iterator ITERATOR_OF_T, sentinel_for<remove_cvref_t<ITERATOR_OF_T>> ITERATOR_OF_T2>
133 InlineBuffer (const ITERATOR_OF_T& start, ITERATOR_OF_T2&& end);
144 nonvirtual
InlineBuffer& operator= (const SPAN_T& copyFrom);
152 nonvirtual explicit operator const T* () const noexcept;
153 nonvirtual explicit operator T* () noexcept;
160 nonvirtual pointer
data () noexcept;
161 nonvirtual const_pointer
data () const noexcept;
166 nonvirtual iterator begin () noexcept;
167 nonvirtual const_iterator begin () const noexcept;
172 nonvirtual iterator end () noexcept;
173 nonvirtual const_iterator end () const noexcept;
179 nonvirtual reference
at (
size_t i) noexcept;
180 nonvirtual const_reference
at (
size_t i) const noexcept;
186 nonvirtual reference operator[] (
size_t i) noexcept;
187 nonvirtual const_reference operator[] (
size_t i) const noexcept;
196 constexpr
size_t capacity () const noexcept;
213 nonvirtual
void reserve (
size_t newCapacity,
bool atLeast = true);
216 [[deprecated ("Since Stroika v3.0d1, just use
reserve with atLeast flag=true)")]]
void ReserveAtLeast (
size_t newCapacityAtLeast)
218 reserve (newCapacityAtLeast,
true);
227 nonvirtual
size_t GetSize () const noexcept;
238 nonvirtual
size_t size () const noexcept;
244 nonvirtual
bool empty () const noexcept;
255 nonvirtual
void resize (
size_t nElements);
265 requires (is_trivially_copyable_v<T> and is_trivially_destructible_v<T>);
273 nonvirtual
void ShrinkTo (
size_t nElements);
282 nonvirtual
void GrowToSize (
size_t nElements);
292 requires (is_trivially_copyable_v<T>);
298 nonvirtual
void Insert (
size_t at, const SPAN_T& copyFrom);
304 nonvirtual
void insert (iterator i, const_pointer from, const_pointer to);
314 nonvirtual
void push_back (Common::ArgByValueType<T> e);
316 nonvirtual
void push_back (const SPAN_T& copyFrom);
322 template <
ISpan SPAN_T>
328 nonvirtual
void clear () noexcept;
330#if qStroika_Foundation_Debug_AssertionsChecked
332 static constexpr byte kGuard1_[8] = {
333 0x45_b, 0x23_b, 0x12_b, 0x56_b, 0x99_b, 0x76_b, 0x12_b, 0x55_b,
335 static constexpr byte kGuard2_[8] = {
336 0x15_b, 0x32_b, 0xa5_b, 0x16_b, 0x11_b, 0x7a_b, 0x90_b, 0x10_b,
342 static constexpr size_t SizeInBytes_ (
size_t nElts)
noexcept
347 return sizeof (T[1]) * nElts;
351 nonvirtual
byte* LiveDataAsAllocatedBytes_ () noexcept;
354 static
byte* Allocate_ (
size_t bytes);
357 static
void Deallocate_ (
byte* bytes) noexcept;
360 static
byte* Reallocate_ (
byte* bytes,
size_t n)
361 requires (is_trivially_copyable_v<T>);
365#if qStroika_Foundation_Debug_AssertionsChecked
366 byte fGuard1_[
sizeof (kGuard1_)];
368 DISABLE_COMPILER_MSC_WARNING_START (4324)
370 size_t fCapacityOfFreeStoreAllocation_;
371 alignas (T)
byte fInlinePreallocatedBuffer_[SizeInBytes_ (BUF_SIZE)];
373 DISABLE_COMPILER_MSC_WARNING_END (4324)
375#if qStroika_Foundation_Debug_AssertionsChecked
376 byte fGuard2_[
sizeof (kGuard2_)];
382 constexpr bool HasEnoughCapacity_ (
size_t sz)
const
386 if (sz <= BUF_SIZE) [[likely]] {
393 constexpr bool UsingInlinePreallocatedBuffer_ () const noexcept;
396 nonvirtual
void Invariant () const noexcept;
399#if qStroika_Foundation_Debug_AssertionsChecked
400 nonvirtual
void Invariant_ () const noexcept;
401 nonvirtual
void ValidateGuards_ () const noexcept;
405 constexpr T* BufferAsT_ () noexcept;
406 constexpr const T* BufferAsT_ () const noexcept;
409 static
void DestroyElts_ (T* start, T* end) noexcept;