This is a parent template for blueprints using crtp. More...
#include <blueprints.hpp>
Public Member Functions | |
BluePrint () | |
Blueprint concept checking. | |
template<typename BaseType > | |
void | implementApply (BaseType &object) const |
Apply the blueprint rules to an existing object. | |
template<typename BaseType > | |
BaseType | implementInstantiate () |
Use the blueprint to instantiate a new object. | |
virtual | ~BluePrint () |
This is a parent template for blueprints using crtp.
Blueprints of various sorts are often passed to a constructor of their associated class. If a template is used to in the constructor call, e.g.
then this tends to create function collisions with other template functions (especially streaming operators). To avoid this, we need a parent class, so for this we use the crtp style (because it avoids any virtual costs).
Classes that are of type Derived must satisfy the blueprint concept (ecl::concepts::BluePrint).
Definition at line 47 of file blueprints.hpp.
ecl::BluePrint< Derived >::BluePrint | ( | ) | [inline] |
Blueprint concept checking.
Check that the derived class satisfies the blueprint concept.
Definition at line 54 of file blueprints.hpp.
virtual ecl::BluePrint< Derived >::~BluePrint | ( | ) | [inline, virtual] |
Definition at line 95 of file blueprints.hpp.
void ecl::BluePrint< Derived >::implementApply | ( | BaseType & | object | ) | const [inline] |
Apply the blueprint rules to an existing object.
A crtp virtual call to its children's apply method. This acts on the blueprint's target class to configure it according to the blueprint. The template parameter is a trick to delay the determination of the target type, because at this point of the compilation it cannot retrieve the base_type from the derived type.
Note, this cannot have the same name as the blueprint method because then the child will inherit it, even if it doesn't have the class and the concept check will fail.
object | : the object to be configured. |
Definition at line 91 of file blueprints.hpp.
BaseType ecl::BluePrint< Derived >::implementInstantiate | ( | ) | [inline] |
Use the blueprint to instantiate a new object.
A crtp virtual call to its children's instantiate method. The template argument is used, because the crtp base cannot catch typedef's in its children at this point of the compilation. With the template parameter this check is delayed until enough of this base class is known.
Note, this cannot have the same name as the blueprint method because then the child will inherit it, even if it doesn't have the class and the concept check will fail.
Definition at line 72 of file blueprints.hpp.