Repository navigation
creation
A policy that defines how the signal internals are created.
namespace creation
{
struct ahead_of_time;
struct lazy;
}
Creates the internals in the signal constructor.
Creates the internals on the first connect to a signal, if the signal is created using the default constructor.
Please note that if the signal is created using a constructor with some parameters, the internals are created right away because there is no way to save the parameters until they are actually needed.
struct my_creation
{
using tag = wigwag::creation::tag<wigwag::api_version<2, 0>>;
template < typename OwningPtr_, typename DefaultType_ >
class storage
{
public:
template < typename T_, typename... Args_ >
void create(Args_&&... args);
const OwningPtr_& get_ptr() const;
bool constructed() const;
};
};using tag = wigwag::creation::tag<wigwag::api_version<2, 0>>;The policy tag. Must be a type alias for wigwag::creation::tag<wigwag::api_version<2, 0>>.
template < typename OwningPtr_, typename DefaultType_ >
class storage;A class used to store a pointer to signal internals.
Template arguments:
- OwningPtr_ - the pointer type. Has 'void reset(DefaultType_*)' and 'explicit operator bool() const' methods.
- DefaultType_ - the default type to be created. See create method description.
template < typename T_, typename... Args_ >
void create(Args_&&... args);This method should either create a T_ object passing all the args... to its constructor, or prepare everything for doing it later in the get_ptr method.
The DefaultType_ storage template argument is a hint for T_. You may check if these two types are the same, and then use DefaultType_ in get_ptr method without need to store any runtime type information.
Template arguments:
- T_ - the type of an object to be created
- Args_... - the parameter types for T_ constructor
Arguments:
- args... - the arguments that you should forward to T_ constructor
const OwningPtr_& get_ptr() const;This method should return an OwningPtr_ to a fully created object.
Return value: OwningPtr_ to signal internals
bool constructed() const;Return value: a boolean indicating whether the signal internals have been actually created