nngn
|
#include <bit>
#include <cassert>
#include <cstring>
#include <functional>
#include <span>
#include <string>
#include <string_view>
#include <type_traits>
#include <utility>
#include <vector>
#include "concepts.h"
#include "concepts/fundamental.h"
Go to the source code of this file.
Classes | |
struct | nngn::detail::chain_cast< T > |
struct | nngn::always_false< T > |
struct | nngn::member_obj_type< O(T::*)> |
struct | nngn::member_obj_type< R(T::*)(Args...)> |
struct | nngn::mem_obj< p > |
struct | nngn::member_less< p > |
Namespaces | |
namespace | nngn |
namespace | nngn::detail |
Macros | |
#define | FWD(...) std::forward<decltype(__VA_ARGS__)>(__VA_ARGS__) |
#define | NNGN_DEFAULT_CONSTRUCT(x) |
#define | NNGN_VIRTUAL(x) |
#define | NNGN_PURE_VIRTUAL(x) |
#define | NNGN_NO_COPY(x) |
#define | NNGN_MOVE_ONLY(x) |
#define | NNGN_NO_MOVE(x) |
#define | NNGN_ANON_IMPL1(l) nngn_anon_ ## l |
#define | NNGN_ANON_IMPL0(l) NNGN_ANON_IMPL1(l) |
#define | NNGN_ANON() NNGN_ANON_IMPL0(__LINE__) |
#define | NNGN_ANON_DECL(...) [[maybe_unused]] const auto NNGN_ANON() = __VA_ARGS__; |
#define | NNGN_CONTAINER_OF(t, n, p) (nngn::byte_cast<t*>(nngn::byte_cast<char*>(p) - offsetof(t, n))) |
#define | NNGN_BIND_MEM_FN(x, f) |
#define | NNGN_EXPOSE_ITERATOR(n, m) |
#define | NNGN_EXPOSE_ITERATOR0(n, m, i) |
Typedefs | |
template<typename T > | |
using | nngn::member_obj_type_t = typename member_obj_type<T>::type |
Enumerations | |
enum class | nngn::empty |
Functions | |
template<typename ... Ts> | |
constexpr | nngn::chain_cast (auto &&x) |
Performs successive static_cast s, 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 span s 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) |
#define FWD | ( | ... | ) | std::forward<decltype(__VA_ARGS__)>(__VA_ARGS__) |
#define NNGN_ANON | ( | ) | NNGN_ANON_IMPL0(__LINE__) |
#define NNGN_ANON_IMPL0 | ( | l | ) | NNGN_ANON_IMPL1(l) |
#define NNGN_BIND_MEM_FN | ( | x, | |
f ) |
#define NNGN_CONTAINER_OF | ( | t, | |
n, | |||
p ) (nngn::byte_cast<t*>(nngn::byte_cast<char*>(p) - offsetof(t, n))) |
#define NNGN_DEFAULT_CONSTRUCT | ( | x | ) |
#define NNGN_MOVE_ONLY | ( | x | ) |
#define NNGN_NO_COPY | ( | x | ) |
#define NNGN_NO_MOVE | ( | x | ) |
#define NNGN_PURE_VIRTUAL | ( | x | ) |
#define NNGN_VIRTUAL | ( | x | ) |