Lumiera
0.pre.03
»edit your freedom«
|
#include "lib/opaque-holder.hpp"
A handle to allow for safe »remote implantation« of an unknown subclass into a given opaque InPlaceBuffer, without having to disclose the concrete buffer type or size.
siz
(buffer size) template parameter from #InPlaceBuffer is deliberately not part of the PlantingHandle<BA,DEFAULT>
type, since buffer size can be considered an opaque implementation detail. As a consequence, we must capture this size information at construction time and store it at runtime #maxSiz_, to protect against buffer overrun. Definition at line 113 of file record.hpp.
Public Member Functions | |
template<size_t maxSiz> | |
PlantingHandle (InPlaceBuffer< BA, maxSiz, DEFAULT > &targetBuffer) | |
template<class SUB > | |
bool | canCreate () const |
template<class SUB , typename... ARGS> | |
SUB & | create (ARGS &&...args) |
Abbreviation for placement new of a subclass SUB into the opaque buffer. | |
template<class SUB > | |
SUB & | emplace (SUB &&implementation) |
move-construct an instance of a subclass into the opaque buffer | |
BA * | get () const |
Private Member Functions | |
template<class SUB > | |
void | __ensure_can_create () |
Private Attributes | |
void * | buffer_ |
size_t | maxSiz_ |
|
inlineprivate |
Helper to ensure the opaque buffer provides sufficient storage
SUB | actual subclass type to be implanted into the opaque buffer |
Definition at line 856 of file opaque-holder.hpp.