This has to be silenced for `sf::Vertex` because in some places within
SFML we initialize only a subset of this aggregate type. If we remove
the `{}` from `texCoords` then we get a compiler warning from Clang. It
feels like these two clang-based tools are somewhat contradictory.
error: missing field 'texCoords' initializer [-Werror,-Wmissing-field-initializers]
m_points.append({{x, y}, {r, g, b}});
It's rare that a type truly needs a .reset function. Copy/move
assignment typically accomplishes the same thing with less code
and is easier to maintain since it doesn't require updating your
.reset() function as new data members are added.
To reset a type is conceptually the same thing as simply assigning
from a newly constructed instance of the same type.
This new API is built on top of std::variant. This allows us to
store many different event types in a space-efficient way and access
the active event type in a type-safe manner that eliminates the
categories of UB that are possible with unions.
Co-authored-by: kimci86 <kimci86@hotmail.fr>
This change was made in 359fe90 due to recommendations from tooling.
On its face this change makes sense since it removes a copy that
isn't always necessary. In practice it caused ergonomic issues due
to now being forced to make a copy of the render states when needed.
The performance gains of eliding this copy are unsubstantiated. We
have not done any profiling to measure its impact. For lack of such
measurements I'd rather err on the side of improved user experience.
If future benchmarks prove this copy is rather expensive then we
can reconsider removing it with that evidence in mind.
While I don't suspect there are any uninitialize variable bugs
present, it's still good to err on the side of safety and provide
an initial value nonetheless.
This silences an MSVC warning about lsbDelta and rsbDelta not being
initialized. Whether or not this fixes any bugs, it provides a
better user experience if nobody sees those warnings.
Character traits are only standardized for character types of which
std::uint8_t is not. All major C++ implementations happen to define
this specialization but because it is not standard C++ they are
allowed to remove it as LLVM has done by deprecating this specialization
in LLVM 18. It is slated for removal in LLVM 19. To avoid compilation
errors and to get ahead of any deprecation warnings when LLVM 18 ships
we need to define our own std::uint8_t character traits.
SFML 4 will have access to C++20's std::u8string which should let us
remove this code.