Template Function sdv::cast(const pointer<uint8_t>&, size_t)#

Function Documentation#

template<typename T>
const T *sdv::cast(const pointer<uint8_t> &rptr, size_t nOffset = 0)#

For the uint8_t pointer a specific cast operation exists.

Attention

Use with care. There is no guarantee that the pointer corresponds to the layout of the requested type. If possible use serialization instead.

Template Parameters:

T – Type to cast to. T must be a standard-layout-type.

Parameters:
  • rptr[in] Reference to the pointer containing the data buffer.

  • nOffset[in] Offset the type starts.

Returns:

Returns a casted pointer if the buffer is large enough (offset + sizeof(T)); NULL otherwise.