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

Storage policy backing real::static_regex: compile-time, stateless. More...

#include <storage.hpp>

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

Classes

struct  state_type
 VM scratch state, all fixed-capacity (zero heap). More...
 

Public Types

using slot_storage = static_vec< std::size_t, slot_count >
 Capture-slot container: fixed-capacity, no heap.
 

Public Member Functions

constexpr program_view view () const
 Returns a non-owning view of the compile-time program.
 
constexpr std::string_view pattern () const
 Returns the pattern text.
 
constexpr flags compiled_flags () const
 Returns the effective flags.
 

Static Public Attributes

static constexpr bool is_compile_time {true}
 Selects the default constructor.
 
static constexpr flags effective_flags {F | detail::parse(Pat.view(), F).inline_flags}
 Flags merged with (?ims).
 
static constexpr pattern_hints hints {build().hints}
 Search hints.
 
static constexpr std::size_t code_size {build().code.size()}
 Instruction count.
 
static constexpr std::size_t class_count {build().classes.size()}
 Distinct class count.
 
static constexpr std::size_t name_count {build().names.size()}
 Named-group count.
 
static constexpr std::size_t cp_class_count {build().cp_classes.size()}
 Code-point class count (klass_cp).
 
static constexpr std::size_t cp_range_count {build().cp_ranges.size()}
 Total code-point ranges.
 
static constexpr std::uint16_t slot_count {build().slot_count}
 2*(groups+1).
 
static constexpr std::array< instr, code_sizecode {take<instr, code_size>(build().code)}
 The program.
 
static constexpr std::array< char_class, class_countclasses
 Interned classes.
 
static constexpr std::array< named_group, name_countnames
 Named groups.
 
static constexpr std::array< cp_class, cp_class_countcp_classes
 Code-point classes.
 
static constexpr std::array< code_range, cp_range_countcp_ranges
 Flat range buffer.
 
static constexpr std::size_t max_blocks {(5 * code_size) + 8}
 

Static Private Member Functions

static constexpr dynamic_program build ()
 Returns the freshly built program (used for both measuring and filling).
 
template<typename T , std::size_t N, typename Vec >
static constexpr std::array< T, Ntake (const Vec &source)
 Copies the first N elements of v into a fixed array.
 

Detailed Description

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

Storage policy backing real::static_regex: compile-time, stateless.

Every array is a static constexpr member sized exactly by a measuring pass over the same compilation, so a static_regex object is stateless (sizeof 1) and matching allocates nothing.

Template Parameters
PatThe pattern, as a real::fixed_string non-type parameter.
FCompilation flags.

Definition at line 793 of file storage.hpp.

Member Typedef Documentation

◆ slot_storage

template<fixed_string Pat, flags F = flags::none>
using real::detail::static_storage< Pat, F >::slot_storage = static_vec<std::size_t, slot_count>

Capture-slot container: fixed-capacity, no heap.

Definition at line 860 of file storage.hpp.

Member Function Documentation

◆ build()

template<fixed_string Pat, flags F = flags::none>
static constexpr dynamic_program real::detail::static_storage< Pat, F >::build ( )
inlinestaticconstexprprivate

Returns the freshly built program (used for both measuring and filling).

Runs only at compile time (a static_regex instantiation), so it is invisible to the runtime coverage report; it is exercised by the constexpr static_asserts in tests/test_static.cpp and tests/test_constexpr.cpp.

Definition at line 806 of file storage.hpp.

◆ compiled_flags()

template<fixed_string Pat, flags F = flags::none>
constexpr flags real::detail::static_storage< Pat, F >::compiled_flags ( ) const
inlineconstexpr

Returns the effective flags.

Definition at line 917 of file storage.hpp.

◆ pattern()

template<fixed_string Pat, flags F = flags::none>
constexpr std::string_view real::detail::static_storage< Pat, F >::pattern ( ) const
inlineconstexpr

Returns the pattern text.

Definition at line 909 of file storage.hpp.

◆ take()

template<fixed_string Pat, flags F = flags::none>
template<typename T , std::size_t N, typename Vec >
static constexpr std::array< T, N > real::detail::static_storage< Pat, F >::take ( const Vec &  source)
inlinestaticconstexprprivate

Copies the first N elements of v into a fixed array.

Template Parameters
TElement type.
NExact size (measured from build).
VecSource container type.
Parameters
[in]sourceThe source vector.
Returns
The exactly-sized array.

Definition at line 827 of file storage.hpp.

◆ view()

template<fixed_string Pat, flags F = flags::none>
constexpr program_view real::detail::static_storage< Pat, F >::view ( ) const
inlineconstexpr

Returns a non-owning view of the compile-time program.

Definition at line 888 of file storage.hpp.

Member Data Documentation

◆ class_count

template<fixed_string Pat, flags F = flags::none>
constexpr std::size_t real::detail::static_storage< Pat, F >::class_count {build().classes.size()}
staticconstexpr

Distinct class count.

Definition at line 841 of file storage.hpp.

◆ classes

template<fixed_string Pat, flags F = flags::none>
constexpr std::array<char_class, class_count> real::detail::static_storage< Pat, F >::classes
staticconstexpr
Initial value:
=
take<char_class, class_count>(build().classes)
static constexpr std::array< char_class, class_count > classes
Interned classes.
Definition storage.hpp:848
static constexpr dynamic_program build()
Returns the freshly built program (used for both measuring and filling).
Definition storage.hpp:806

Interned classes.

Definition at line 848 of file storage.hpp.

◆ code

template<fixed_string Pat, flags F = flags::none>
constexpr std::array<instr, code_size> real::detail::static_storage< Pat, F >::code {take<instr, code_size>(build().code)}
staticconstexpr

The program.

Definition at line 847 of file storage.hpp.

◆ code_size

template<fixed_string Pat, flags F = flags::none>
constexpr std::size_t real::detail::static_storage< Pat, F >::code_size {build().code.size()}
staticconstexpr

Instruction count.

Definition at line 840 of file storage.hpp.

◆ cp_class_count

template<fixed_string Pat, flags F = flags::none>
constexpr std::size_t real::detail::static_storage< Pat, F >::cp_class_count {build().cp_classes.size()}
staticconstexpr

Code-point class count (klass_cp).

Definition at line 843 of file storage.hpp.

◆ cp_classes

template<fixed_string Pat, flags F = flags::none>
constexpr std::array<cp_class, cp_class_count> real::detail::static_storage< Pat, F >::cp_classes
staticconstexpr
Initial value:
=
take<cp_class, cp_class_count>(build().cp_classes)
static constexpr std::array< cp_class, cp_class_count > cp_classes
Code-point classes.
Definition storage.hpp:852

Code-point classes.

Definition at line 852 of file storage.hpp.

◆ cp_range_count

template<fixed_string Pat, flags F = flags::none>
constexpr std::size_t real::detail::static_storage< Pat, F >::cp_range_count {build().cp_ranges.size()}
staticconstexpr

Total code-point ranges.

Definition at line 844 of file storage.hpp.

◆ cp_ranges

template<fixed_string Pat, flags F = flags::none>
constexpr std::array<code_range, cp_range_count> real::detail::static_storage< Pat, F >::cp_ranges
staticconstexpr
Initial value:
=
take<code_range, cp_range_count>(build().cp_ranges)
static constexpr std::array< code_range, cp_range_count > cp_ranges
Flat range buffer.
Definition storage.hpp:854

Flat range buffer.

Definition at line 854 of file storage.hpp.

◆ effective_flags

template<fixed_string Pat, flags F = flags::none>
constexpr flags real::detail::static_storage< Pat, F >::effective_flags {F | detail::parse(Pat.view(), F).inline_flags}
staticconstexpr

Flags merged with (?ims).

Definition at line 838 of file storage.hpp.

◆ hints

template<fixed_string Pat, flags F = flags::none>
constexpr pattern_hints real::detail::static_storage< Pat, F >::hints {build().hints}
staticconstexpr

Search hints.

Definition at line 839 of file storage.hpp.

◆ is_compile_time

template<fixed_string Pat, flags F = flags::none>
constexpr bool real::detail::static_storage< Pat, F >::is_compile_time {true}
staticconstexpr

Selects the default constructor.

Definition at line 795 of file storage.hpp.

◆ max_blocks

template<fixed_string Pat, flags F = flags::none>
constexpr std::size_t real::detail::static_storage< Pat, F >::max_blocks {(5 * code_size) + 8}
staticconstexpr

Definition at line 864 of file storage.hpp.

◆ name_count

template<fixed_string Pat, flags F = flags::none>
constexpr std::size_t real::detail::static_storage< Pat, F >::name_count {build().names.size()}
staticconstexpr

Named-group count.

Definition at line 842 of file storage.hpp.

◆ names

template<fixed_string Pat, flags F = flags::none>
constexpr std::array<named_group, name_count> real::detail::static_storage< Pat, F >::names
staticconstexpr
Initial value:
=
take<named_group, name_count>(build().names)
static constexpr std::array< named_group, name_count > names
Named groups.
Definition storage.hpp:850

Named groups.

Definition at line 850 of file storage.hpp.

◆ slot_count

template<fixed_string Pat, flags F = flags::none>
constexpr std::uint16_t real::detail::static_storage< Pat, F >::slot_count {build().slot_count}
staticconstexpr

2*(groups+1).

Definition at line 845 of file storage.hpp.


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