REAL
Regular Expression Algorithmic Library — constexpr C++20 regex
Loading...
Searching...
No Matches
real::detail::static_storage< Pat, F >::measured Struct Reference

Everything build yields that is NOT a range, measured in ONE evaluation. More...

#include <storage.hpp>

Collaboration diagram for real::detail::static_storage< Pat, F >::measured:
[legend]

Public Attributes

pattern_hints hints {}
 Search hints.
 
std::size_t code_size {}
 Instruction count.
 
std::size_t class_count {}
 Distinct byte-class count.
 
std::size_t name_count {}
 Named-group count.
 
std::size_t cp_class_count {}
 Code-point class count (klass_cp).
 
std::size_t cp_range_count {}
 Total code-point ranges.
 
std::uint16_t slot_count {}
 2*(groups+1).
 

Detailed Description

template<fixed_string Pat, flags F = flags::none>
struct real::detail::static_storage< Pat, F >::measured

Everything build yields that is NOT a range, measured in ONE evaluation.

The two-phase this class is built on – measure, then freeze, because C++20 forbids persistent constexpr allocation – does not say how many times to measure, and the measuring had grown to SEVEN separate build() calls: one per size, one per scalar, each its own top-level constant expression re-running the whole compiler front end. Collapsed here to one, halving the number of build() evaluations the class costs (the five range members below are the rest).

That is a compile-time change with no run-time surface: the frozen arrays are byte-identical, because they are produced by the same take calls from the same builder. What it buys is headroom against the per-expression constexpr step budget – the ceiling class_tables below is already annotated for, and the reason build_byte_program reaches only byte classes.


The documentation for this struct was generated from the following file: