32#ifndef STEAM_ENGINE_TYPE_HANDLER_H
33#define STEAM_ENGINE_TYPE_HANDLER_H
41#include <boost/functional/hash.hpp>
51 using std::placeholders::_1;
58 template<
class X,
typename...ARGS>
62 new(storageBuffer) X(forward<ARGS> (args)...);
69 X* embedded =
static_cast<X*
> (storageBuffer);
73 template<
typename CTOR,
typename DTOR>
78 boost::hash_combine (
hash,
typeid(CTOR).hash_code());
79 boost::hash_combine (
hash,
typeid(DTOR).hash_code());
129 template<
typename CTOR,
typename DTOR>
133 ,
identity{deriveCombinedTypeIdenity<CTOR,DTOR>()}
144 template<
class X,
typename...ARGS>
148 return TypeHandler ( bind (buildIntoBuffer<X,ARGS&...>, _1, forward<ARGS> (args)...)
149 , destroyInBuffer<X>);
174 return not (left == right);
Lumiera error handling (C++ interface).
Hash value types and utilities.
size_t HashVal
a STL compatible hash value
void buildIntoBuffer(void *storageBuffer, ARGS &&...args)
void destroyInBuffer(void *storageBuffer)
HashVal deriveCombinedTypeIdenity()
Steam-Layer implementation namespace root.
A pair of functors to maintain a datastructure within a buffer.
function< void(void *)> DoInBuffer
friend bool operator==(TypeHandler const &left, TypeHandler const &right)
DoInBuffer destroyAttached
friend HashVal hash_value(TypeHandler const &handler)
static TypeHandler create(ARGS &&...args)
builder function for a pre-configured TypeHandler to place a new instance into the buffer,...
TypeHandler()
build an invalid NIL TypeHandler
DoInBuffer createAttached
static const TypeHandler RAW
Marker for the default case: raw buffer without type handling.
TypeHandler(CTOR ctor, DTOR dtor)
build a TypeHandler binding to arbitrary constructor and destructor functions.
friend bool operator!=(TypeHandler const &left, TypeHandler const &right)