|
| template<typename ... Ts> |
| constexpr | nngn::chain_cast (auto &&x) |
| | Performs successive static_casts, right to left.
|
| |
| template<typename To , typename From > |
| To | nngn::narrow (const From &x) |
| | Casts x to a narrower type, asserting that the value is preserved.
|
| |
| template<typename T , typename U > |
| constexpr | nngn::cast (U &&x) |
| | Cast value to T with the strictest cast operator.
|
| |
template<typename To , typename From >
requires byte_pointer<To> || byte_pointer<From> |
| constexpr To | nngn::byte_cast (From p) |
| | reinterpret_cast restricted to conversions from/to char/uchar.
|
| |
template<typename To , typename From >
requires byte_type<To> || char_type<To> || byte_type<From> || char_type<From> |
| std::span< To > | nngn::byte_cast (std::span< From > s) |
| | Cast between spans where one is a byte type.
|
| |
| template<enum_ T> |
| constexpr auto | nngn::to_underlying (T t) |
| |
| constexpr auto | nngn::ptr_diff (const auto *lhs, const auto *rhs) |
| | Signed distance in bytes between pointers.
|
| |
| constexpr bool | nngn::ptr_cmp (const auto *p0, const auto *p1) |
| | Compares the address of two pointers.
|
| |
| template<standard_layout T> |
| std::size_t | nngn::offsetof_ptr (auto T::*p) |
| | Similar to the stdlib's offsetof, but using member data pointers.
|
| |
| auto | nngn::as_bytes (const void *p) |
| |
| auto | nngn::as_bytes (void *p) |
| |
| std::span< const std::byte > | nngn::as_byte_span (const auto *x) |
| |
| std::span< std::byte > | nngn::as_byte_span (auto *x) |
| |
| constexpr bool | nngn::str_less (const char *lhs, const char *rhs) |
| |
template<typename To , typename From >
requires ( sizeof(To) == sizeof(From) && std::is_trivially_copyable_v<To> && std::is_trivially_copyable_v<From>) |
| constexpr auto | nngn::bit_cast (const From &from) |
| |
| template<typename T > |
| constexpr auto | nngn::set_bit (T t, T mask, bool value) |
| |
| constexpr | nngn::rptr (auto &&r) |
| | Allows passing an rvalue pointer to a function.
|
| |
| bool | nngn::read_file (std::string_view filename, std::string *ret) |
| |
| bool | nngn::read_file (std::string_view filename, std::vector< std::byte > *ret) |
| |