103 using const_pointer =
const T*;
109 using const_iterator =
const T*;
114 using reference = T&;
115 using const_reference =
const T&;
130 InlineBuffer (UninitializedConstructorFlag flag,
size_t nElements);
131 template <
size_t FROM_BUF_SIZE>
135 template <input_iterator ITERATOR_OF_T, sentinel_for<remove_cvref_t<ITERATOR_OF_T>> ITERATOR_OF_T2>
136 InlineBuffer (const ITERATOR_OF_T& start, ITERATOR_OF_T2&& end);
147 nonvirtual
InlineBuffer& operator= (const SPAN_T& copyFrom);
155 nonvirtual explicit operator const T* () const noexcept;
156 nonvirtual explicit operator T* () noexcept;
163 nonvirtual pointer
data () noexcept;
164 nonvirtual const_pointer
data () const noexcept;
169 nonvirtual iterator begin () noexcept;
170 nonvirtual const_iterator begin () const noexcept;
175 nonvirtual iterator end () noexcept;
176 nonvirtual const_iterator end () const noexcept;
182 nonvirtual reference
at (
size_t i) noexcept;
183 nonvirtual const_reference
at (
size_t i) const noexcept;
189 nonvirtual reference operator[] (
size_t i) noexcept;
190 nonvirtual const_reference operator[] (
size_t i) const noexcept;
199 constexpr
size_t capacity () const noexcept;
216 nonvirtual
void reserve (
size_t newCapacity,
bool atLeast = true);
219 [[deprecated ("Since Stroika v3.0d1, just use
reserve with atLeast flag=true)")]]
void ReserveAtLeast (
size_t newCapacityAtLeast)
221 reserve (newCapacityAtLeast,
true);
230 nonvirtual
size_t GetSize () const noexcept;
241 nonvirtual
size_t size () const noexcept;
247 nonvirtual
bool empty () const noexcept;
258 nonvirtual
void resize (
size_t nElements);
268 requires (is_trivially_copyable_v<T> and is_trivially_destructible_v<T>);
276 nonvirtual
void ShrinkTo (
size_t nElements);
285 nonvirtual
void GrowToSize (
size_t nElements);
295 requires (is_trivially_copyable_v<T>);
301 nonvirtual
void Insert (
size_t at, const SPAN_T& copyFrom);
302 nonvirtual
void Insert (
size_t at, const T& item);
308 nonvirtual
void insert (iterator i, const_pointer from, const_pointer to);
318 nonvirtual
void push_back (Common::ArgByValueType<T> e);
320 nonvirtual
void push_back (const SPAN_T& copyFrom);
326 template <
ISpan SPAN_T>
339 nonvirtual
void Remove (
size_t from,
size_t to);
344 nonvirtual
void clear () noexcept;
346#if qStroika_Foundation_Debug_AssertionsChecked
348 static constexpr byte kGuard1_[8] = {
349 0x45_b, 0x23_b, 0x12_b, 0x56_b, 0x99_b, 0x76_b, 0x12_b, 0x55_b,
351 static constexpr byte kGuard2_[8] = {
352 0x15_b, 0x32_b, 0xa5_b, 0x16_b, 0x11_b, 0x7a_b, 0x90_b, 0x10_b,
358 static constexpr size_t SizeInBytes_ (
size_t nElts)
noexcept
363 return sizeof (T[1]) * nElts;
367 nonvirtual
byte* LiveDataAsAllocatedBytes_ () noexcept;
370 static
byte* Allocate_ (
size_t bytes);
373 static
void Deallocate_ (
byte* bytes) noexcept;
376 static
byte* Reallocate_ (
byte* bytes,
size_t n)
377 requires (is_trivially_copyable_v<T>);
381#if qStroika_Foundation_Debug_AssertionsChecked
382 byte fGuard1_[
sizeof (kGuard1_)];
384 DISABLE_COMPILER_MSC_WARNING_START (4324)
386 size_t fCapacityOfFreeStoreAllocation_;
387 alignas (T)
byte fInlinePreallocatedBuffer_[SizeInBytes_ (BUF_SIZE)];
389 DISABLE_COMPILER_MSC_WARNING_END (4324)
391#if qStroika_Foundation_Debug_AssertionsChecked
392 byte fGuard2_[
sizeof (kGuard2_)];
398 constexpr bool HasEnoughCapacity_ (
size_t sz)
const
402 if (sz <= BUF_SIZE) [[likely]] {
409 constexpr bool UsingInlinePreallocatedBuffer_ () const noexcept;
412 nonvirtual
void Invariant () const noexcept;
415#if qStroika_Foundation_Debug_AssertionsChecked
416 nonvirtual
void Invariant_ () const noexcept;
417 nonvirtual
void ValidateGuards_ () const noexcept;
421 constexpr T* BufferAsT_ () noexcept;
422 constexpr const T* BufferAsT_ () const noexcept;
425 static
void DestroyElts_ (T* start, T* end) noexcept;