|
REAL
Regular Expression Algorithmic Library — constexpr C++20 regex
|
The name-resolution context a result owns when it must outlive the regex it came from. More...
#include <storage.hpp>
Public Attributes | |
| std::string | pattern |
| Owned copy of the pattern text. | |
| std::vector< named_group > | names |
| Owned copy of the named-group table. | |
The name-resolution context a result owns when it must outlive the regex it came from.
A result resolves a group name by comparing it against the pattern text at the offsets its named-group table records, so it borrows BOTH from the regex. The borrow is free and correct while the regex is alive, which is the documented contract; on a temporary regex it is a read of freed memory. A result produced from an rvalue regex copies both here instead. The copy is shared, so copying such a result shares the context rather than duplicating it, and the cost lands only where a pattern was just compiled – which allocates far more than this.