|
REAL
Regular Expression Algorithmic Library — constexpr C++20 regex
|
This view is COPIED ON EVERY find_iter AND count_matches CALL, so its size is a per-call cost and growing it is a decision, not a detail.
More...
Public Member Functions | |
| constexpr program_view | view () const |
| Returns a non-owning program_view over this program. | |
Public Attributes | |
| std::vector< instr > | code |
| The instruction stream (main program + lookaround sub-program regions). | |
| std::vector< char_class > | classes |
| Interned character classes. | |
| std::vector< named_group > | names |
| Named capture groups. | |
| std::vector< lookaround_sub > | lookarounds |
| Bounded lookaround sub-programs (regions of code). | |
| std::vector< cp_class > | cp_classes |
Match-time code-point classes (for klass_cp). | |
| std::vector< code_range > | cp_ranges |
Flat range buffer the cp_class slices index into. | |
| std::vector< instr > | prefix_code |
| IL: the inner-literal prefix sub-program (the part before the literal), for the reverse start-finder. Empty unless there is a required literal with a top-level prefix. Dynamic-only (not built during constant evaluation). | |
| std::vector< char_class > | prefix_classes |
| IL: classes for prefix_code. | |
| std::vector< cp_class > | prefix_cp_classes |
| IL: code-point classes (klass_cp) for prefix_code. | |
| std::vector< code_range > | prefix_cp_ranges |
| IL: flat range buffer for prefix_cp_classes. | |
| std::uint16_t | slot_count {2} |
2 * (capture groups + 1). | |
| bool | byte_mode {} |
| flags::bytes mode. | |
| bool | unicode_word {} |
\b \B \< \> use Unicode word-ness (text mode). | |
| pattern_hints | hints |
| Search-acceleration hints. | |
| std::int32_t | codepoint_mark_ascii {-1} |
| ASCII sub-class index of an emitted codepoint-class block (-1 = none). | |
| std::int32_t | codepoint_mark_offset {-1} |
| Where that block starts (program offset); the whole-pattern hint requires offset 1. | |
| std::int32_t | codepoint_mark_end {-1} |
| Program offset right after that block ends (-1 = none). | |
This view is COPIED ON EVERY find_iter AND count_matches CALL, so its size is a per-call cost and growing it is a decision, not a detail.
A ceiling rather than a stopwatch, and that is the point. A per-call cost of this shape is fixed: it does not scale with the subject, so it hides under the noise floor of any throughput row and surfaces only on short inputs. Timing cannot guard it – the effect is the same order as the floor of the rows that would carry it – so it is guarded by COUNTING bytes instead, the same way per-call allocations are guarded by counting them rather than timing them.
The number is not a target to hit but a line to notice crossing: ten spans plus pattern_hints plus the scalars and pointers. Lower it when the view shrinks, and raise it only with the reason written down – a change that adds a span here charges every call on both surfaces.
Guarded on the pointer width because std::span is two pointers: a literal byte count would fail on a 32-bit target for no reason (this project has a win32-narrowing CI leg), and the concern – do not silently make the per-call copy bigger – is the same on any width.
Owning, heap-allocated program: the storage backing real::regex.
|
inlineconstexpr |
Returns a non-owning program_view over this program.