Maze Builder Docs 8.10.23
Loading...
Searching...
No Matches
mazes::create_contract Class Referenceabstract

Contract for the create function in the runtime. More...

#include <create_contract.h>

Inheritance diagram for mazes::create_contract:
[legend]

Public Member Functions

virtual std::any create (const args &a, randomizer &rng) noexcept=0
template<typename T>
std::optional< T > create_as (const args &a, randomizer &rng) noexcept
 Calls create and extracts the result as T.

Detailed Description

Contract for the create function in the runtime.

Implementations return their result type-erased in a std::any. Results must be owning values (e.g. std::string, never std::string_view) and an empty std::any signals failure. Callers should use create_as<T>() to retrieve the result with a type check.

Member Function Documentation

◆ create()

◆ create_as()

template<typename T>
std::optional< T > mazes::create_contract::create_as ( const args & a,
randomizer & rng )
inlinenodiscardnoexcept

Calls create and extracts the result as T.

Returns
The result, or std::nullopt if creation failed or produced a different type

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