An engine built on first use and published once: a reader after the build takes no lock, and a copy made while another thread builds sees the finished engine or none (and then builds its own). Copyable, so the regex that holds it stays copyable.
More...
#include <regex_core.hpp>
|
| | lazy_std_engine (const lazy_std_engine &other) |
| | Copies other's engine if it is published.
|
| |
| | lazy_std_engine (lazy_std_engine &&other) noexcept |
| | Takes other's engine if it is published; other is left without one.
|
| |
| lazy_std_engine & | operator= (const lazy_std_engine &other) |
| | Replaces this engine with a copy of other's, if published.
|
| |
| lazy_std_engine & | operator= (lazy_std_engine &&other) noexcept |
| | Replaces this engine with other's, if published; other is left without one.
|
| |
| const StdRegex * | get () const noexcept |
| | The published engine.
|
| |
| const StdRegex & | publish (StdRegex &&engine) const |
| | Publishes engine; the caller holds the build lock and has seen get return null.
|
| |
|
void | reset () noexcept |
| | Drops the engine; not concurrent with any other use of this object.
|
| |
| void | swap (lazy_std_engine &other) noexcept |
| | Exchanges the engines; not concurrent with any other use of either object.
|
| |
|
|
std::optional< StdRegex > | value_ |
| | The engine, set once under the build lock.
|
| |
|
std::atomic< bool > | ready_ {false} |
| | Released after value_ is set: acquire it before reading.
|
| |
template<typename StdRegex>
class real::compat::detail::lazy_std_engine< StdRegex >
An engine built on first use and published once: a reader after the build takes no lock, and a copy made while another thread builds sees the finished engine or none (and then builds its own). Copyable, so the regex that holds it stays copyable.
- Template Parameters
-
| StdRegex | The engine: a std::basic_regex, or the end_variants of a REAL pattern. |
◆ lazy_std_engine() [1/2]
template<typename StdRegex >
Copies other's engine if it is published.
- Parameters
-
◆ lazy_std_engine() [2/2]
template<typename StdRegex >
Takes other's engine if it is published; other is left without one.
- Parameters
-
◆ copy_from()
template<typename StdRegex >
Copies other's engine if published; this one holds none.
- Parameters
-
◆ get()
template<typename StdRegex >
The published engine.
- Returns
- It, or null before publish.
◆ operator=() [1/2]
template<typename StdRegex >
Replaces this engine with a copy of other's, if published.
- Parameters
-
- Returns
- This.
◆ operator=() [2/2]
template<typename StdRegex >
Replaces this engine with other's, if published; other is left without one.
- Parameters
-
- Returns
- This.
◆ publish()
template<typename StdRegex >
Publishes engine; the caller holds the build lock and has seen get return null.
- Parameters
-
| [in] | engine | The built engine. |
- Returns
- The published engine.
◆ swap()
template<typename StdRegex >
Exchanges the engines; not concurrent with any other use of either object.
- Parameters
-
| [in,out] | other | The other engine. |
The documentation for this class was generated from the following file: