Skip to content

String Theory 3.0

Compare
Choose a tag to compare
@zrax zrax released this 06 Jan 23:38
· 97 commits to master since this release
3.0

Major Changes

  • String Theory 3.0 is now a header-only library. You still need CMake for configuring st_config.h and building the tests, but after installing it, only the include directory is necessary.
    • Note: For CMake projects, no change is necessary to use 3.0. The provided library is converted to an INTERFACE library which includes the required include directory and removes any linked libs.
  • String Theory 3.0 now requires C++11 at minimum. If you still need support for pre-C++11 compilers, you will need to stay on 2.x.
  • Many parts of String Theory which previously called ST_ASSERT for interface violations have been updated to throw exceptions instead. ST_ASSERT is now reserved only for unrecoverable failures in the library are not due to misuse of the API.
  • Breaking: The default format of individual characters in ST::format and friends is changed to their equivalent integral types, in order to avoid type aliasing issues in some environments. In order to remain compatible with both 2.x and 3.0, callers should use the "{c}" format specifier to explicitly request character formatting.

Changes, Additions, Fixes

  • Moved user-defined literals to the ST::literals namespace to avoid namespace collisions. When porting, you can use using namespace ST::literals; to re-enable their use.
  • Added an _stfmt user-defined literal which can be used for literal format strings. For example:
    "The {} is {}"_stfmt("answer", 42);
  • De-obfuscated the mechanism for declaring custom formatters. The old macros will still work, but new code should declare a format_type overload directly now. See Defining Custom Formatters for details.
  • Conversion between all supported encodings (UTF-8, UTF-16, UTF-32, Latin-1 and wchar_t) is now available outside of the ST::string class, including between encodings which previously did not have any direct conversion available. See the wiki for details.
  • Support basic (case-sensitive) comparison on ST::buffer<T> objects with compare() and operator<().
  • Fix UTF-8 conversions to not skip invalid sequence bytes when converting with substitutes. This behavior matches other UTF-8 implementations, including Python and Qt5.
  • Add more support for STL string classes in ST::format and ST::string_stream (Thanks @Hoikas)
  • Several performance improvements.
  • Several unit testing improvements in both coverage and functionality.

Removed Features

  • APIs marked deprecated in 2.0 are now removed.
  • ST::set_assert_handler and ST::set_default_assert_handler were removed since ST_ASSERT is no longer used for interface violations.
  • ST::utf_validation_t::assert_validity is removed since it no longer makes any sense.
  • Removed implicit conversions to std::string_view.