1#ifndef NE_STL_INCLUDENE_STL_MEMORY_H
2#define NE_STL_INCLUDENE_STL_MEMORY_H
9template <
class TElement>
12template <
class TElement>
16 template <
class TElement>
18 return new TElement[count]();
20 template <
class TElement>
22 if (element_ptr !=
nullptr) {
24 element_ptr =
nullptr;
27 template <
class TObject,
class... TArgs>
29 return new TObject(args...);
31 template <
class TObject>
33 if (object_ptr !=
nullptr) {
38 template <
typename TObject,
typename... TArgs>
40 TObject* ret = (TObject*)malloc(
sizeof(TObject));
43 new (ret) TObject(args...);
46 template <
typename TObject>
48 if (
object ==
nullptr)
50 char* src = (
char*)
object;
62 template <class _Ty2, class = typename std::enable_if<std::is_convertible<_Ty2*, _Ty*>::value,
void>::type>
65 static_assert(0 <
sizeof(_Ty),
"can't delete an incomplete type");
81 static uint16_t param = 0x0001;
82 if (*(uint8_t*)(¶m) == 0x01)
Definition ne_stl_spinlock.h:61
Definition ne_stl_spinlock.h:44
Definition ne_stl_atomic.h:131
Definition ne_stl_any.h:7
EM_Byte_Endian_Order
Definition ne_stl_memory.h:69
void(*)(TElement *&) element_delete_fun_t
Definition ne_stl_memory.h:13
TElement *(*)(std::size_t) element_malloc_fun_t
Definition ne_stl_memory.h:10
Definition ne_stl_memory.h:73
static bool same_to_host(EM_Byte_Endian_Order order)
Definition ne_stl_memory.h:91
static bool is_little_endian()
Definition ne_stl_memory.h:92
static EM_Byte_Endian_Order value()
Definition ne_stl_memory.h:74
Definition ne_stl_memory.h:59
default_delete< _Ty > _Myt
Definition ne_stl_memory.h:60
default_delete()
Definition ne_stl_memory.h:61
void operator()(_Ty *_Ptr) const
Definition ne_stl_memory.h:64
default_delete(const default_delete< _Ty2 > &)
Definition ne_stl_memory.h:63
Definition ne_stl_memory.h:15
static void safe_delete(TObject *&object_ptr)
Definition ne_stl_memory.h:32
static TObject * new_obj(TArgs... args)
Definition ne_stl_memory.h:39
static bool delete_obj(TObject *&object)
Definition ne_stl_memory.h:47
static TElement * safe_malloc_container_element(std::size_t count)
Definition ne_stl_memory.h:17
static TObject * safe_new(TArgs... args)
Definition ne_stl_memory.h:28
static void safe_delete_container_element(TElement *&element_ptr)
Definition ne_stl_memory.h:21