Go to the documentation of this file.
34 #include "../../Primitives/interface/BasicTypes.h"
35 #include "../../Primitives/interface/MemoryAllocator.h"
36 #include "../../Platforms/Basic/interface/DebugUtilities.hpp"
42 typename std::enable_if<std::is_destructible<T>::value,
void>::type
Destruct(T* ptr)
48 typename std::enable_if<!std::is_destructible<T>::value,
void>::type
Destruct(T* ptr)
52 template <
typename T,
typename AllocatorType>
66 #ifdef DILIGENT_DEVELOPMENT
67 , m_dvpDescription{Description}
68 , m_dvpFileName {FileName }
69 , m_dvpLineNumber {LineNumber }
79 #ifdef DILIGENT_DEVELOPMENT
80 , m_dvpDescription{other.m_dvpDescription}
81 , m_dvpFileName {other.m_dvpFileName }
82 , m_dvpLineNumber {other.m_dvpLineNumber }
92 #ifdef DILIGENT_DEVELOPMENT
93 , m_dvpDescription{other.m_dvpDescription}
94 , m_dvpFileName {other.m_dvpFileName }
95 , m_dvpLineNumber {other.m_dvpLineNumber }
108 #ifdef DILIGENT_DEVELOPMENT
109 DEV_CHECK_ERR(m_dvpDescription == other.m_dvpDescription,
"Incosistent allocator descriptions");
110 DEV_CHECK_ERR(m_dvpFileName == other.m_dvpFileName,
"Incosistent allocator file names");
111 DEV_CHECK_ERR(m_dvpLineNumber == other.m_dvpLineNumber,
"Incosistent allocator line numbers");
123 #ifndef DILIGENT_DEVELOPMENT
124 static constexpr
const char* m_dvpDescription =
"<Unavailable in release build>";
125 static constexpr
const char* m_dvpFileName =
"<Unavailable in release build>";
126 static constexpr
Int32 m_dvpLineNumber = -1;
128 return reinterpret_cast<T*
>(
m_Allocator.Allocate(count *
sizeof(T), m_dvpDescription, m_dvpFileName, m_dvpLineNumber));
145 template <
class U,
class... Args>
148 ::new (p) U(std::forward<Args>(args)...);
157 #ifdef DILIGENT_DEVELOPMENT
158 const Char*
const m_dvpDescription;
159 const Char*
const m_dvpFileName;
160 Int32 const m_dvpLineNumber;
164 #define STD_ALLOCATOR(Type, AllocatorType, Allocator, Description) STDAllocator<Type, AllocatorType>(Allocator, Description, __FILE__, __LINE__)
166 template <
class T,
class U,
class A>
172 template <
class T,
class U,
class A>
175 return !(left == right);
179 #define STD_ALLOCATOR_RAW_MEM(Type, Allocator, Description) STDAllocatorRawMem<Type>(Allocator, Description, __FILE__, __LINE__)
181 template <
class T,
typename AllocatorType>
187 m_Allocator{&Allocator}
194 m_Allocator{rhs.m_Allocator}
196 rhs.m_Allocator =
nullptr;
201 m_Allocator = rhs.m_Allocator;
202 rhs.m_Allocator =
nullptr;
208 VERIFY(m_Allocator !=
nullptr,
"The deleter has been moved away or never initialized, and can't be used");
210 m_Allocator->Free(ptr);
214 AllocatorType* m_Allocator =
nullptr;
char Char
Definition: BasicTypes.h:64
pointer address(reference r)
Definition: STDAllocator.hpp:131
STDAllocator< U, AllocatorType > other
Definition: STDAllocator.hpp:118
const value_type * const_pointer
Definition: STDAllocator.hpp:57
size_type max_size() const
Definition: STDAllocator.hpp:139
const value_type & const_reference
Definition: STDAllocator.hpp:59
AllocatorType & m_Allocator
Definition: STDAllocator.hpp:156
bool operator==(const Plane3D &p1, const Plane3D &p2)
Definition: AdvancedMath.hpp:442
#define DEV_CHECK_ERR(...)
Definition: DebugUtilities.hpp:90
void operator()(T *ptr) noexcept
Definition: STDAllocator.hpp:206
STDAllocator(STDAllocator< U, AllocatorType > &&other) noexcept
Definition: STDAllocator.hpp:89
Vector3< T > max(const Vector3< T > &a, const Vector3< T > &b)
Definition: BasicMath.hpp:1660
STDAllocator & operator=(STDAllocator< U, AllocatorType > &&other) noexcept
Definition: STDAllocator.hpp:102
Definition: STDAllocator.hpp:53
void deallocate(T *p, std::size_t count)
Definition: STDAllocator.hpp:134
STDDeleter(AllocatorType &Allocator) noexcept
Definition: STDAllocator.hpp:186
const_pointer address(const_reference r)
Definition: STDAllocator.hpp:132
int32_t Int32
32-bit signed integer
Definition: BasicTypes.h:46
std::ptrdiff_t difference_type
Definition: STDAllocator.hpp:61
std::size_t size_type
Definition: STDAllocator.hpp:60
STDDeleter & operator=(STDDeleter &&rhs) noexcept
Definition: STDAllocator.hpp:199
STDDeleter() noexcept
Definition: STDAllocator.hpp:184
STDAllocator(AllocatorType &Allocator, const Char *Description, const Char *FileName, const Int32 LineNumber) noexcept
Definition: STDAllocator.hpp:63
STDDeleter(STDDeleter &&rhs) noexcept
Definition: STDAllocator.hpp:193
void construct(U *p, Args &&... args)
Definition: STDAllocator.hpp:146
Definition: STDAllocator.hpp:182
T * allocate(std::size_t count)
Definition: STDAllocator.hpp:121
#define VERIFY(...)
Definition: DebugUtilities.hpp:76
Definition: STDAllocator.hpp:116
value_type * pointer
Definition: STDAllocator.hpp:56
T value_type
Definition: STDAllocator.hpp:55
void destroy(pointer p)
Definition: STDAllocator.hpp:151
STDDeleter & operator=(const STDDeleter &)=default
value_type & reference
Definition: STDAllocator.hpp:58
bool operator!=(const STDAllocator< T, A > &left, const STDAllocator< U, A > &right)
Definition: STDAllocator.hpp:173
STDAllocator(const STDAllocator< U, AllocatorType > &other) noexcept
Definition: STDAllocator.hpp:76
The library uses Direct3D-style math:
Definition: AdvancedMath.hpp:37
std::enable_if< std::is_destructible< T >::value, void >::type Destruct(T *ptr)
Definition: STDAllocator.hpp:42