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.
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.
sf::RenderWindow still inherits a virtual destructor from a base
class so there's no need to explicitly declare a virtual destructor.
I added a test to ensure this property was not broken.
The purpose of those was to make it obvious that an action is needed to
update KeyCount or ScancodeCount when adding more enumerators, but we
rarely touch those enumerations so it is not worth adding those
technical names to the public API.
Those values are not valid Key or Scancode values, so it doesn't make
sense for them to have Key or Scancode type.
Moving them out of their enum makes it possible to write exhaustive
switch case statement without having to write a case for those values.
Making them unsigned int allows to use them as array size without having
to do a static_cast.
std::array lets us have a single source of truth for array size
rather than needing separate constants or magic numbers that have
to stay in sync with the underlying array.