preliminary
Pointer Types
-
template<typename Underlying_T>
class not_null Makes your code crash when using
nullptrs on the bind-point instead of the dereference point.Which should make debugging easier in case of a logical error.
Removes the is this a nullptr? checks as it is now implied through construction.
Has zero-size-overhead over
Underlying_T.The constructor is
explicitso that whenT*changes tonot_null<T*>, the call-sites that used the oldT*form stop compiling and require explicitly specifying that they indeed understand the passed pointer should not be null.ALLOWS construction from
Underlying_T(which MUST benullptr_tassignable)ALLOWS implicit conversion to
Underlying_TDISALLOWS default construction
DISALLOWS construction from
nullptr_tDISALLOWS pointer arithmetics
FORCES explicit construction when passing pointers around
THROWS when constructing an
Underlying_Twith a null value
- Template Parameters:
Underlying_T – The underlying pointer type
-
template<typename Underlying_T, Underlying_T null_value = nullptr>
class null_on_move Holds an
Underlying_T, assigns it tonull_valuewhen this object is moved.Note
For avoiding the need to explicitly implement the move constructor for objects that hold non-raii-handles (eg. Vulkan, Wayland).
-
template<typename T>
using ref = std::shared_ptr<T> Wrapper around
std::shared_ptr.Note
Currently just an alias, might turn into an implementation later. https://en.cppreference.com/w/cpp/memory/shared_ptr.html
-
template<typename Underlying_T, typename ...Args>
constexpr ref<Underlying_T> create_ref(Args&&... args) Allocates memory for an
Underlying_Tand directly constructs it there.- Returns:
A
ref<Underlying_T>to the constructed object.
-
template<typename Underlying_T>
constexpr ref<Underlying_T> make_ref(Underlying_T *raw_pointer) Converts c-style pointer of type
Underlying_Tto aref<Underlying_T>.
-
template<typename t>
using scope = std::unique_ptr<t> Wrapper around
std::unique_ptr.Note
Currently just an alias, might turn into an implementation later. https://en.cppreference.com/w/cpp/memory/unique_ptr.html
-
template<typename Underlying_T, typename ...Args>
constexpr scope<Underlying_T> create_scope(Args&&... args) Allocates memory for an
Underlying_Tand directly constructs it there.- Returns:
A
scope<Underlying_T>to the constructed object.
-
template<typename Underlying_T>
constexpr scope<Underlying_T> make_scope(Underlying_T *raw_pointer) Converts c-style pointer of type
Underlying_Tto ascope<Underlying_T>.
Build Constants
-
enum class build_constants::Platform : u8
Values:
-
enumerator gnu_linux
The GNU/Linux platform.
Tested on the following distros: arch-x86_64
Note
: Named like so because
linuxis a built-in identifier, not because of the memes.
-
enumerator windows
The Microsoft Windows(tm) platform.
Currently not supported.
-
enumerator mac
The apple’s macOS platform.
Currently not supported.
-
enumerator gnu_linux
Convenient Aliases
-
using u8 = ::std::uint8_t
-
using u16 = ::std::uint16_t
-
using u32 = ::std::uint32_t
-
using u64 = ::std::uint64_t
-
using i8 = ::std::int8_t
-
using i16 = ::std::int16_t
-
using i32 = ::std::int32_t
-
using i64 = ::std::int64_t
-
using f32 = float
-
using f64 = double
-
using size_t = ::std::size_t