Loading...
Searching...
No Matches
Vdf_DefaultInitAllocator< T, AllocatorBase > Class Template Reference

Vdf_DefaultInitAllocator. More...

#include <defaultInitAllocator.h>

Inherits allocator< T >.

Public Member Functions

template<typename U >
void construct (U *ptr) noexcept(std::is_nothrow_default_constructible_v< U >)
 Value initializing construction.
 
template<typename U , typename... Args>
void construct (U *ptr, Args &&... args)
 Construction with custom constructor arguments.
 

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

◆ construct() [1/2]

void construct ( U *  ptr)
inlinenoexcept

Value initializing construction.

This method instead default initializes instances of U.

Definition at line 46 of file defaultInitAllocator.h.

◆ construct() [2/2]

void 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: