Function allocate

Synopsis

#include <Source/Falcor/Utils/AlignedAllocator.h>

template <typename T, typename ... Args>
T * allocate(Args &&... args)

Description

Allocates an object of given type and executes its constructor.

Parameters:

[ in ] args - Arguments to pass to the constructor.

Return
pointer to allocated object.

Source

Lines 72-78 in Source/Falcor/Utils/AlignedAllocator.h.

template <typename T, typename ...Args> T* allocate(Args&&... args)
{
    const size_t size = sizeof(T);
    computeAndAllocatePadding(size);
    void* ptr = allocInternal(size);
    return new (ptr) T(std::forward<Args>(args)...);
}





Add Discussion as Guest

Log in to DocsForge