This function is slower than it needs to be due to the expensive inserts at
the front of the string. The new version is 38 times faster for a 9-digit
number using GCC 13.2 with full optimizations according to Quick Bench.
The warning is about invalid memory usage within the loop in
case `strSize` is zero. It is supposedly not correct because
then the loop would never be entered anyways in that case.
However, it is likely nevertheless a good idea to silence the
warning.
* Add/update binary conversion functions to use `std::memcopy`
* Only GCC could actually optimize the custom code using bit operations
* Clang could only optimize the `getBytes()` functions
* MSVC could not optimize any of the functions
* The to…Int…() functions cannot be updated as they are `constexpr` (and
thus `std::memcopy` and `reinterpret_cast` cannot be used). So they stay
as-is and `toInt()` has been added instead
* The `BinaryReader` class has been updated to use the new `toInt()`
function
This works around errors which Clang 11.1.0 has when parsing this header
from GCC 11.1.0. (Yes, at this point the GCC and Clang versions which are
currently in Arch Linux testing are identical.)
IntegralType and BaseType need to be kept different types, otherwise one
runs into deduction errors if both arguments have different types (which is
quite likely in practise). Since the base is always a small positive
integer the cast should always be safe.
* Allow using a range as input of joinStrings()
* Use `std::string_view` instead of `const std::string &` to pass read-only
parameters to joinStrings() and splitString*() to avoid constructing an
`std::string` from `const char *` parameters
* Use auto for return types of toMultiline() and toArrayOfLines()
* Does not affect BC because those are template functions
* Should not affect source compatibility; at least uses in my main projects
seem to be unaffected
* So one could use e.g. `std::unordered_set<std::string_view>` as target
container when splitting an `std::string_view`.
* Still an experimental feature
It seems that std::make_tuple() is using __decay_and_strip so
the arguments get copied. Using the std::tuple c'tor directly
instead.
When using the %-operator it is already taken care that strings
are stored as pointers and not by value.