libyggdrasil
v1.0.0
|
Commonly used helper functions. More...
Go to the source code of this file.
Classes | |
struct | bsp::dependent_false< T > |
Helper type trait for using static_asserts that should always trigger an error when evaluated. More... | |
class | bsp::scope_guard::ScopeGuardImpl< F > |
Scope Guard implementation. More... | |
struct | bsp::ByteSwapped< T > |
Helper class to store the data of a given type in reverse order. More... | |
Namespaces | |
bsp | |
bsp::scope_guard | |
Macros | |
#define | TOKEN_CONCAT_IMPL(x, y) x ## y |
#define | TOKEN_CONCAT(x, y) TOKEN_CONCAT_IMPL(x, y) |
#define | ANONYMOUS_VARIABLE(prefix) TOKEN_CONCAT(prefix, __COUNTER__) |
#define | SCOPE_GUARD ::bsp::scope_guard::ScopeGuardOnExit() + [&]() |
Scope Guard for executing code when exiting the current scope with the ability to release it. More... | |
#define | ON_SCOPE_EXIT auto ANONYMOUS_VARIABLE(SCOPE_EXIT_) = SCOPE_GUARD |
Scope Guard for always executing code when exiting the current scope. More... | |
Enumerations | |
enum | bsp::scope_guard::ScopeGuardOnExit |
Functions | |
template<typename F > | |
constexpr ScopeGuardImpl< F > | bsp::scope_guard::operator+ (ScopeGuardOnExit, F &&f) |
template<typename To , typename From > | |
To | bsp::bit_cast (const From &src) noexcept |
std::bit_cast implementation for doing reinterpret_cast-style conversion without invoking undefined behaviour More... | |
template<typename T > | |
constexpr T | bsp::byteSwap (T value) |
Swaps bytes of input value to convert between big and little endian. More... | |
template<typename T > | |
auto | bsp::enumValue (T value) |
Casts a scoped enum type into its underlying value. More... | |
ALWAYS_INLINE void | bsp::doNotOptimize (const auto &value) |
Confuses the compiler to prevent it from optimizing out a variable. Helpful for debugging. More... | |
Variables | |
template<typename T > | |
constexpr auto | bsp::dependent_false_v = dependent_false<T>::value |
Commonly used helper functions.
#define ANONYMOUS_VARIABLE | ( | prefix | ) | TOKEN_CONCAT(prefix, __COUNTER__) |
#define ON_SCOPE_EXIT auto ANONYMOUS_VARIABLE(SCOPE_EXIT_) = SCOPE_GUARD |
Scope Guard for always executing code when exiting the current scope.
Example use: ON_SCOPE_EXIT { doCleanup(); };
#define SCOPE_GUARD ::bsp::scope_guard::ScopeGuardOnExit() + [&]() |
Scope Guard for executing code when exiting the current scope with the ability to release it.
Example use: auto cleanup = SCOPE_GUARD { doCleanup(); };
#define TOKEN_CONCAT | ( | x, | |
y | |||
) | TOKEN_CONCAT_IMPL(x, y) |
#define TOKEN_CONCAT_IMPL | ( | x, | |
y | |||
) | x ## y |