|
cxxomfort
rel.20211024
Simple backports for C++ - https://ryan.gulix.cl/fossil.cgi/cxxomfort/
|
Backports related to Standard header <string>
Interfaces defined in this section:
to_string() (C++11) - convert C++ integers/floats into strings.to_string(short) , to_string(long) , to_string(double) etc, for the compilers that missed some overloads (eg.: MSVC 2010).strtoll() , strtoull() function family (C++11) - convert strings into long s , for the compilers that missed them (MSVC).hash<> specialization for std::basic_string where not available.""s to C++11.Interfaces not in std:
C++14 onwards defines operator"" s as the user-defined literal to create basic_string objects. The cxxomfort library backports the string and wstring capable versions to C++11, directly into namespace std (as std::literals::s).
""s is reserved. While this means the library can add the backport correctly, it could be that the compiler is blocking its use. It is compiler-dependent whether it is possible to disable this warning or error (see eg.: https://stackoverflow.com/questions/31509434/gcc-does-not-honor-pragma-gcc-diagnostic-to-silence-warnings ).-isystem.cxxomfort::fix::s() instead (see the next section).The helper function s() creates a basic_string . It is provided to serve as a supplement to the "user-defined literal" ""s where it is not available:
C++20 adds new member functions to basic_string and basic_string_view. Since it is not possible in C++ to extend a class with new methods, and the interface for basic_string is already crap (see []), cxxomfort implements them as nonmember accessors à-la-<iterator>.
For relevant documentation see Nonmember helpers for string types .
1.8.13