HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Vdf_DefaultInitAllocator< T, AllocatorBase > Class Template Reference

#include <defaultInitAllocator.h>

+ Inheritance diagram for Vdf_DefaultInitAllocator< T, AllocatorBase >:

Classes

struct  rebind
 

Public Member Functions

template<typename U >
void construct (U *ptr) noexcept(std::is_nothrow_default_constructible_v< U >)
 
template<typename U , typename... Args>
void construct (U *ptr, Args &&...args)
 

Detailed Description

template<typename T, typename AllocatorBase = std::allocator<T>>
class Vdf_DefaultInitAllocator< T, AllocatorBase >

Vdf_DefaultInitAllocator

This allocator intercepts value initialization and turns it into default initialization. It's primary purpose is for use on containers, such as std::vector, that are first resized and then immediately filled with elements. Without the use of this allocator, the resize would value-initialize every element before immediately overwriting the element when it's filled in.

Definition at line 27 of file defaultInitAllocator.h.

Member Function Documentation

template<typename T , typename AllocatorBase = std::allocator<T>>
template<typename U >
void Vdf_DefaultInitAllocator< T, AllocatorBase >::construct ( U *  ptr)
inlinenoexcept

Value initializing construction. This method instead default initializes instances of U.

Definition at line 46 of file defaultInitAllocator.h.

template<typename T , typename AllocatorBase = std::allocator<T>>
template<typename U , typename... Args>
void Vdf_DefaultInitAllocator< T, AllocatorBase >::construct ( U *  ptr,
Args &&...  args 
)
inline

Construction with custom constructor arguments. This method simply forwards any arguments to the U constructor.

Definition at line 56 of file defaultInitAllocator.h.


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