General Utilities#
Generic Helpers#
#include <dplx/cncr/utils.hpp>
namespace dplx::cncr {}
-
template<typename Enum>
requires std::is_enum_v<Enum>
constexpr auto to_underlying(Enum value) noexcept -> std::underlying_type_t<Enum># A backport of C++23 to_underlying(Enum value).
- Returns:
The underlying integer value with the deduced underlying type.
-
struct is_null_byte_fn#
-
struct is_non_null_byte_fn#
-
constexpr auto is_non_null_byte(std::byte const value) noexcept -> bool#
- Returns:
value != std::byte{}
-
[[noreturn]] inline void unreachable() noexcept#
Calling this function explicitly invokes Undefined Behaviour. Therefore it can be used to inform the compiler about code invariants by calling it in places unreachable by the execution flow.
Warning
Only ever use this as a last resort in performance critical code after benchmarking the possible gains.
-
DPLX_ATTR_FORCE_INLINE#
Expands to something equivalent to
inline
with compiler specific hints to encourage inlining. It’s main use case are transparent forwarding wrapper functions.Warning
Needs to be used sparingly in order to prevent machine code bloat.
-
DPLX_ATTR_NO_UNIQUE_ADDRESS#
Expands to
[[no_unique_address]]
, a compiler specific equivalent or nothing if not supported by the current compiler.See also
C++ Reference: no_unique_address
Lambda Overloading#
#include <dplx/overladed.hpp>
namespace dplx {}