Hegel 0.11.4
Property-based testing for C++
Loading...
Searching...
No Matches
hegel::generators::DeferredGeneratorDefinition< T > Class Template Reference

A forward reference to a generator whose definition is provided later. More...

#include <combinators.h>

Public Member Functions

Generator< T > generator () const
 Return a handle that delegates to whatever is later passed to set(). May be called multiple times. Drawing from it before set() is called throws.
void set (Generator< T > gen)
 Set the implementation for this deferred generator.

Detailed Description

template<typename T>
class hegel::generators::DeferredGeneratorDefinition< T >

A forward reference to a generator whose definition is provided later.

Created by deferred(). Call generator() to obtain handles that can be embedded in other generators before the implementation is known, then call set() to install it. This enables self-recursive and mutually recursive generators.

Template Parameters
TValue type produced by the eventual generator.

Member Function Documentation

◆ generator()

template<typename T>
Generator< T > hegel::generators::DeferredGeneratorDefinition< T >::generator ( ) const
inline

Return a handle that delegates to whatever is later passed to set(). May be called multiple times. Drawing from it before set() is called throws.

Returns
A Generator that delegates to the implementation installed by set().

◆ set()

template<typename T>
void hegel::generators::DeferredGeneratorDefinition< T >::set ( Generator< T > gen)
inline

Set the implementation for this deferred generator.

All handles previously returned by generator() delegate to gen. May be called only once. A second call throws. Drawing from a handle before set() is called throws.

Parameters
genThe generator to install as the implementation.

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