|
REAL
Regular Expression Algorithmic Library — constexpr C++20 regex
|
The either-or storage: the inline buffer, or a pointer to the heap block once the vector has spilled. is_heap_ says which member is active. More...
Public Member Functions | |
| constexpr | Storage () noexcept |
| Starts in the inline state. | |
| constexpr | ~Storage () |
| Destruction handled by cleanup. | |
| Storage (const Storage &)=delete | |
| Storage & | operator= (const Storage &)=delete |
| Storage (Storage &&)=delete | |
| Storage & | operator= (Storage &&)=delete |
Public Attributes | |
| inline_block | inline_buffer |
| Inline storage (when not heap). | |
| T * | heap_ptr |
| Heap storage (when is_heap_). | |
The either-or storage: the inline buffer, or a pointer to the heap block once the vector has spilled. is_heap_ says which member is active.
|
inlineconstexprnoexcept |
Starts in the inline state.
At run time the inline buffer is left UNINITIALIZED: small_vec writes every element through std::construct_at (placement-new) before any read (push_back and assign), so the value-init is pure overhead — and a tokenizing walk builds a fresh slot buffer per match, of which two slots serve, so it is overhead per match. At compile time the member must be active and initialized for the constexpr matching path (which assigns through inline_data while it is the active member), so it is value-initialized there via construct_at on the whole inline_block — activating a class-type member is what a constexpr union allows (an element-wise or bare C-array activation is not). A constant-evaluated spill switches the active member to Storage::heap_ptr through adopt_heap, and revert_to_inline switches back.