|
REAL
Regular Expression Algorithmic Library — constexpr C++20 regex
|
A uniquely-owning, deep-copying box for owned_name_context that survives constant evaluation. More...
#include <storage.hpp>
Public Member Functions | |
| constexpr | name_context_box () noexcept=default |
| Constructs an empty box, owning nothing. | |
| constexpr | name_context_box (const name_context_box &other) |
| Deep-copies the other box's context, if it has one. | |
| constexpr | name_context_box (name_context_box &&other) noexcept |
| Takes over the other box's context, leaving it empty. | |
| constexpr name_context_box & | operator= (const name_context_box &other) |
| Deep-copy assignment. | |
| constexpr name_context_box & | operator= (name_context_box &&other) noexcept |
| Move assignment. | |
| constexpr | ~name_context_box () |
| Releases the owned context, if any. | |
| constexpr void | emplace (std::string pattern, std::vector< named_group > names) |
Replaces the owned context with one built from pattern and names. | |
| constexpr const owned_name_context * | get () const noexcept |
Returns the owned context, or nullptr when the box is empty. | |
Private Member Functions | |
| constexpr void | adopt (const owned_name_context &src) |
Allocates and copy-constructs a context from src. | |
| constexpr void | release () noexcept |
| Releases the owned context. Precondition: the box owns one. | |
| constexpr void | reset () noexcept |
| Destroys and deallocates the owned context, if any. | |
Private Attributes | |
| owned_name_context * | ptr_ {nullptr} |
The owned context, or nullptr. | |
A uniquely-owning, deep-copying box for owned_name_context that survives constant evaluation.
No standard smart pointer is literal, and a constant-evaluable real::regex needs a literal result; std::allocator is the only constexpr-usable source, and its blocks are transient. Deep copy, not shared: the box is null on every borrowing result, so that path pays a pointer and a null test.
|
inlineconstexpr |
Deep-copies the other box's context, if it has one.
| [in] | other | The box to copy. |
|
inlineconstexprnoexcept |
Takes over the other box's context, leaving it empty.
| [in,out] | other | The box to move from. |
|
inlineconstexprprivate |
Allocates and copy-constructs a context from src.
Reached only behind an [[unlikely]] test, by a copy of a result detached from a temporary regex: a warm path here would bid for the unit's inline budget against the scan routes.
| [in] | src | The context to copy. |
|
inlineconstexpr |
Replaces the owned context with one built from pattern and names.
| [in] | pattern | The pattern text to own. |
| [in] | names | The named-group table to own. |
|
inlineconstexprnoexcept |
Returns the owned context, or nullptr when the box is empty.
nullptr.
|
inlineconstexpr |
Deep-copy assignment.
| [in] | other | The box to copy. |
*this.
|
inlineconstexprnoexcept |
Move assignment.
| [in,out] | other | The box to move from. |
*this.
|
inlineconstexprprivatenoexcept |
Releases the owned context. Precondition: the box owns one.
Split out of reset, behind its [[unlikely]] test: a borrowing result runs the null test only.