MPD
0.20.6
|
#include "Alloc.hxx"
#include "Compiler.h"
#include <type_traits>
#include <utility>
#include <new>
#include <cstdlib>
Go to the source code of this file.
Functions | |
template<class T , typename... Args> | |
gcc_malloc T * | NewVarSize (size_t declared_tail_size, size_t real_tail_size, Args &&...args) |
Allocate and construct a variable-size object. More... | |
template<typename T > | |
gcc_nonnull_all void | DeleteVarSize (T *instance) |
gcc_nonnull_all void DeleteVarSize | ( | T * | instance | ) |
Definition at line 75 of file VarSize.hxx.
gcc_malloc T* NewVarSize | ( | size_t | declared_tail_size, |
size_t | real_tail_size, | ||
Args &&... | args | ||
) |
Allocate and construct a variable-size object.
That is useful for example when you want to store a variable-length string as the last attribute without the overhead of a second allocation.
T | a struct/class with a variable-size last attribute |
declared_tail_size | the declared size of the last element in #T |
real_tail_size | the real required size of the last element in #T |
Definition at line 55 of file VarSize.hxx.