SDL3pp
A slim C++ wrapper for SDL3
|
We define an wrapped state when we have a opaque void*, an integer or enum that just represent some state or handle that does not relate to any allocation (it is safe to copy around), but it has some OO-like macro properties to query and or OO-like functions to manipulate it.
An wrap state is class with a single attribute storing the state, and with a constexpr converting constructor from the state type and a constexpr converting operator back to it. This usually is not recommended in C++ style guides, but we do this in order to make the state usable transparently. If there is no need for using it transparently. then we have a get function instead.
If the state has some sort of invalid or uninitialized state, we also create a converting operator to bool that is true when the state valid.
There should be a default comparison operator, also constexpr and if possible using the spaceship <=>
.