No need to use locale-specific character type detection when ASCII.
Locale-specific implementation on Windows is not that very fast.
Signed-off-by: Simon Rozman <simon@rozman.si>
"C"-locale is basically ASCII while (Microsoft) implementation is not
quite performant to our likes. We can do faster.
Signed-off-by: Simon Rozman <simon@rozman.si>
This is analogous to string.hpp's strlen, strcpy, strcat, which use C++
polymorphism rather than function name decorations for char/wchar_t
flavors.
Signed-off-by: Simon Rozman <simon@rozman.si>
Like with stdex::locale_t, this frees us from using Windowsizms on other
platforms. Sockets came from Unix to Windows and not the other way
around in the first place.
Signed-off-by: Simon Rozman <simon@rozman.si>
Unfortunately, this requires at least C++17, but the inline is exactly
what we need to avoid redundant copies of static const data.
Signed-off-by: Simon Rozman <simon@rozman.si>
It requires libuuid-devel on Linux and since this function is optional, lets
not impose libuuid-devel dependency on anything that #include
<stdex/string.hpp>.
Signed-off-by: Simon Rozman <simon@rozman.si>
The stdex::sys_info is instantiated for each compilation unit. To reduce
amount of copies, move it to a separate .hpp as system.hpp is almost
always #included.
Breaking-change: Add #include <stdex/sys_info.hpp>
Signed-off-by: Simon Rozman <simon@rozman.si>
Where we need to read from/write to m_source and immediately apply its
state to our converter, we already have methods for this.
Signed-off-by: Simon Rozman <simon@rozman.si>
While runtime asserts also served as MSVC Code Analysis hints, the lack
of asserts in Release builds provides no hints to Code Analysis which
rises a lot of warnings then.
Maybe I should learn how to use SAL to annotate <ptr, len> parameter
pairs to allow ptr==nullptr when and only when len==0? 😇
Signed-off-by: Simon Rozman <simon@rozman.si>
When deriving, C++ might believe the derived class is still movable. But
it's not and rather than deleting move constructor and operator, this
approach made simpler code.
Signed-off-by: Simon Rozman <simon@rozman.si>