Epok Engine

EPOK RUNTIME

epok::object_construct

Function template · 1 overload

Function template

Placement-new into caller storage; destroy runs the virtual destructor of the concrete type, so a base pointer never slices.

Belongs to
epok
Header
object_model.hpp
Overloads
1

Declaration

template
Declaration
template<class T> Object* object_construct(void* storage)

Placement-new into caller storage; destroy runs the virtual destructor of the concrete type, so a base pointer never slices.

ParameterTypeMeaning
storagevoid *Value supplied for storage. Keep referenced or pointed-to data valid for the complete call.

Returns: Object *. Check the value before continuing when it represents success, availability or a resource handle.

Example

C++ example
#include "object_model.hpp"

// Replace these template arguments with types or values accepted by the declaration:
// T

// Assume these named values have been initialized with valid data:
// void * storage

auto result = epok::object_construct<T>(storage);

Why use it

Template dispatch is resolved at compile time and normally adds no runtime indirection.

Trade-offs and warnings

Every instantiated type must satisfy the header's compile-time requirements; extra instantiations can increase code size. Pointer/reference arguments are borrowed unless the source contract says otherwise; keep them valid for the complete operation and never assume null is accepted.

Declared in runtime/object_model.hpp:190

Related members