restinio::extra_data_buffer_t< Extra_Data > Class Template Reference

Helper for holding a pointer to a buffer where a new object of type Extra_Data should be constructed. More...

`#include <request_handler.hpp>`

## Public Member Functions

| extra_data_buffer_t (void *buffer)
RESTINIO_NODISCARD void * | get () const noexcept

## Private Attributes

void * | m_buffer

## Detailed Description

template<typename Extra_Data>
class restinio::extra_data_buffer_t< Extra_Data >

Helper for holding a pointer to a buffer where a new object of type Extra_Data should be constructed.

This class is intended to make the construction of new objects of type Extra_Data inside a preallocated buffer more type-safe.

An instance of Extra_Data is incorporated into a request object by holding a buffer of necessary capacity and alignment inside request object. The `make_within` method of extra-data-factory is called for the construction of new instance of Extra_Data in that buffer. If raw void pointer will be passed to `make_within` method then it would make possible a case when wrong extra-data-factory can be used.

But if a pointer to the buffer for new instance will be wrapped into extra_data_buffer_t then it allows additional type checks from the compiler. That is why a extra-data-factory receives extra_data_buffer_t<Extra_Data> as a parameter to `make_within` instead of raw pointers.

Since
  v.0.6.13

Definition at line 51 of file request_handler.hpp.

## Constructor & Destructor Documentation

## extra_data_buffer_t()

template<typename Extra_Data >

restinio::extra_data_buffer_t< Extra_Data >::extra_data_buffer_t | ( | void * | buffer | ) |

inline

Definition at line 56 of file request_handler.hpp.

## Member Function Documentation

## get()

template<typename Extra_Data >

RESTINIO_NODISCARD void * restinio::extra_data_buffer_t< Extra_Data >::get | ( |  | ) | const

inline noexcept

Definition at line 60 of file request_handler.hpp.

## Member Data Documentation

## m_buffer

template<typename Extra_Data >

void* restinio::extra_data_buffer_t< Extra_Data >::m_buffer

private

Definition at line 53 of file request_handler.hpp.

The documentation for this class was generated from the following file:

- restinio/request_handler.hpp