43 template <
typename _Type>
47 return ptr ==
nullptr;
51 template <
typename _Type>
55 return ptr.get() ==
nullptr;
59 template <
typename _Type>
68 template <
typename _Type>
76 template <
typename _Type,
typename U>
84 template <
typename _Type,
typename U>
92 template <
typename _Derived,
class _Base>
96 if constexpr (std::is_pointer_v<_Base>)
98 _Derived res =
dynamic_cast<_Derived
>(x);
100 "invalid dynamic cast from " <<
typeid(_Base).name() <<
" to " <<
typeid(_Derived).name()
105 return static_cast<_Derived
>(x);
114 template <
typename _Type>
122 template <
typename _Type>
135 template <
typename _Type>
147 template <
typename _Type>
156 template <
typename _Type>
168 template <
typename _Type,
typename... _Args>
172 _Type* arr =
new(std::nothrow) _Type(args...);
181 template <
typename _Type>
185 _Type* arr =
new _Type[n];
187 "Could not allocate memory for new object"
190 arr[i] = _Type(fill);
195 template <
typename _Type>
199 _Type* arr =
new(std::nothrow) _Type[n];
201 "Could not allocate memory for new object"
203 memcpy(arr,src,
sizeof(_Type)*n);
#define CEPS_ABORT_IF(condition, message)
Stops the execution with a message if condition is true. If testing is enabled, only throws a runtime...
std::make_unsigned_t< CepsInt > CepsUInt
Unsigned version on CepsInt.
A namespace for all utility methods.
_Type * newArray(long unsigned int n, _Type fill=_Type())
Creates a C-array with optional init value.
void destroyTabular(_Type &)
Destroy[delete] any type.
CepsBool isValidPtr(_Type *ptr)
Tells if pointer is not null.
_Derived runtimeCast(_Base x)
Perform a runtime cast between base type and derived type if we can.
_Type * getNew(_Args... args)
Allocates memory for one object. Be careful, the expansion of arguments may produce some weird result...
CepsBool isNullPtr(_Type *ptr)
Tells if passed pointer is null.
CepsBool isDifferentPtr(_Type *xptr, U *yptr)
Tells if two pointers designate two different addresses.
void destroyObject(_Type &)
Destroy[delete] any type.
_Type * newCopyArray(_Type *src, long unsigned int n)
Generates a C-style copy of a C-style array.
CepsBool isSamePtr(_Type *xptr, U *yptr)
Tells if two pointers designate the same address.