REAL
Regular Expression Algorithmic Library — constexpr C++20 regex
Loading...
Searching...
No Matches
real::compat::re2::LazyRE2 Struct Reference

RE2's LazyRE2: a pattern compiled on first use, once, thread-safely – static LazyRE2 re = {"a+"}; then RE2::FullMatch(text, *re). An aggregate, as RE2's, so the members are public; only pattern_ and options_ are meant to be set, by that brace initialisation. More...

#include <re2.hpp>

Public Member Functions

const RE2 & operator* () const
 The compiled pattern.
 
const RE2 * operator-> () const
 The compiled pattern.
 
const RE2 * get () const
 The compiled pattern, compiled on the first call from any thread.
 

Public Attributes

const char * pattern_
 The pattern text.
 
RE2::CannedOptions options_ {RE2::DefaultOptions}
 
std::optional< RE2 > compiled_ {}
 Set once, on first use. Its {} spares a caller writing {.pattern_ = ...} a missing-initializer warning.
 
std::once_flag once_ {}
 Guards the first use.
 

Detailed Description

RE2's LazyRE2: a pattern compiled on first use, once, thread-safely – static LazyRE2 re = {"a+"}; then RE2::FullMatch(text, *re). An aggregate, as RE2's, so the members are public; only pattern_ and options_ are meant to be set, by that brace initialisation.

Member Function Documentation

◆ get()

const RE2 * real::compat::re2::LazyRE2::get ( ) const
inline

The compiled pattern, compiled on the first call from any thread.

Returns
A pointer to it.

◆ operator*()

const RE2 & real::compat::re2::LazyRE2::operator* ( ) const
inline

The compiled pattern.

Returns
It, compiled on the first call.

◆ operator->()

const RE2 * real::compat::re2::LazyRE2::operator-> ( ) const
inline

The compiled pattern.

Returns
A pointer to it, compiled on the first call.

Member Data Documentation

◆ options_

RE2::CannedOptions real::compat::re2::LazyRE2::options_ {RE2::DefaultOptions}

The options it is compiled with.


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