Death namespace

Shared root namespace.

The shared root namespace contains definitions and classes that don't depend on any other namespace. Most of the definitions are defined in CommonBase.h, which should be included (even transitively) in every .h/.cpp file to avoid issues due to missing configuration-specific and platform-specific definitions. Most of the time Common.h should be used instead, which also includes <cstddef>, <cstdint> and some function-like macros. For event tracing and assertions, see Asserts.h.

Namespaces

namespace Backward
Exception handling implementation.
namespace Containers
Container implementations.
namespace Cpu
Compile-time and runtime CPU instruction set detection and dispatch.
namespace Environment
Platform-specific environment helper functions.
namespace IO
File system, streaming and IO-related classes.
namespace Threading
Multithreading-related classes.
namespace Trace
Runtime event tracing implementation, should be used along with Asserts.h.
namespace Utf8
Unicode (UTF-8. UTF-16 and UTF-32) utilities.

Classes

class IDisposable
Base interface for releasing resources on object destruction.
class ITraceSink
Interface for sink to be used by logger writing to it.
class Memory
Memory-related utilities.

Functions

template<class T>
auto forward(typename std::remove_reference<T>::type& t) -> T&& constexpr noexcept
Forwards an l-value.
template<class T>
auto forward(typename std::remove_reference<T>::type&& t) -> T&& constexpr noexcept
Forwards an r-value.
template<class T>
auto move(T&& t) -> std::remove_reference<T>::type&& constexpr noexcept
Converts a value to an r-value.
template<class T>
void swap(T& a, T& b) noexcept(…)
Swaps two values.
template<std::size_t size, class T>
void swap(T(&a)[size], T(&b)[size]) noexcept(…)
Swaps two arrays.
template<typename T, typename U>
auto runtime_cast(U* u) -> T noexcept
Casts a pointer to another type.
template<typename T, typename U>
auto runtime_cast(const U* u) -> T noexcept
template<typename T, typename U>
auto runtime_cast(const std::shared_ptr<U>& u) -> T noexcept
template<typename T, typename U>
auto runtime_cast(const std::unique_ptr<U>& u) -> T noexcept

Function documentation

#include <Base/Move.h>
template<class T>
T&& Death::forward(typename std::remove_reference<T>::type& t) constexpr noexcept

Forwards an l-value.

Returns static_cast<T&&>(t). Equivalent to std::forward(), which is used to implement perfect forwarding, but without the #include <utility> dependency and guaranteed to be constexpr even in C++11.

#include <Base/Move.h>
template<class T>
T&& Death::forward(typename std::remove_reference<T>::type&& t) constexpr noexcept

Forwards an r-value.

Returns static_cast<T&&>(t). Equivalent to std::forward(), which is used to implement perfect forwarding, but without the #include <utility> dependency and guaranteed to be constexpr even in C++11.

#include <Base/Move.h>
template<class T>
std::remove_reference<T>::type&& Death::move(T&& t) constexpr noexcept

Converts a value to an r-value.

Returns static_cast<typename std::remove_reference<T>::type&&>(t). Equivalent to std::move(), but without the #include <utility> dependency and guaranteed to be constexpr even in C++11.

#include <Base/Move.h>
template<class T>
void Death::swap(T& a, T& b) noexcept(…)

Swaps two values.

Swaps specified values. Equivalent to std::swap(), but without the #include <utility> dependency, and without the internals delegating to std::move(), hurting debug performance. In order to keep supporting custom specializations, the usage pattern should be similar to the standard utility, i.e. with using Death::swap.

#include <Base/Move.h>
template<std::size_t size, class T>
void Death::swap(T(&a)[size], T(&b)[size]) noexcept(…)

Swaps two arrays.

Does the same as swap(T&, T&), but for every array element.

template<typename T, typename U>
T Death::runtime_cast(U* u) noexcept

Casts a pointer to another type.

Safely converts pointers to classes up, down, and sideways along the inheritance hierarchy of classes annotated by DEATH_RUNTIME_OBJECT() in an optimized way. Additionally, it can perform downcast at no performance cost. It also pulls the actual pointer from std::shared_ptr and std::unique_ptr without taking ownership.

template<typename T, typename U>
T Death::runtime_cast(const U* u) noexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<typename T, typename U>
T Death::runtime_cast(const std::shared_ptr<U>& u) noexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<typename T, typename U>
T Death::runtime_cast(const std::unique_ptr<U>& u) noexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.