3.0
This is a major release with some breaking changes
Changed
- C++20 or higher is now required for compilation. In particular, the following C++20 features must be available:
- Ranges support in standard library (
__cpp_lib_ranges >= 201911) - Three-way comparison (spaceship operator)
char8_ttypestd::endiansupport in standard library (__cpp_lib_endian >= 201907)- Minimal compilers known to work include: GCC 12, Clang 16, Apple Clang 15.4 and MSVC 17.6.
- Ranges support in standard library (
- The library has been range-ified.
- All methods that used to accept iterator pairs now take iterator/sentinel pairs.
- All these methods now also have overloads that accept ranges
- Existing informal ranges (
sys_string::char_access,sys_string::utf_view, etc.) are now
formal ranges or views. - As part of the above
sys_string::utfX_viewclasses has been renamed tosys_string::utfX_access(because they are
not formally views as defined by standard library). The old names have been retained for compatibility but annotated
as deprecated. Note thatsys_string_builder::utf_viewremains under the same name since it is a view. - Breaking change: as part of the above change the
sys_string::utf_accessandsys_string_builder::utf_viewnow
return distinct iterators and sentinels (that is they no longer satisfystd::ranges::common_rangeconcept).
You will need to use ranges algorithms with their iterators (e.g.std::ranges::for_eachrather thanstd::for_each). - The global
utf_viewtemplate has been split into two:utf_ref_viewthat takes underlying range by reference (similar
tostd::ref_view) andutf_owning_viewthat owns a movable underlying range (similar tostd::owning_view). These
are automatically produced byas_utfrange adapter closures (see below in Added section) - Breaking change: the non-standard
Cursorclasses has been removed.
- The library has been concept-ified.
- Most templated library calls now have concepts checks that validate their argument types.
- Primitive
std::enable_ifused before have been subsumed by these and removed.
- Unicode data used for case folding and whitespace detection has been updated to version 16.0.0
Added
sys_string_tcan now be+-ed with any forward range of any type of character (including C strings and std::string).
This results in a the same optimized addition as when addingsys_string_tobjects.sys_string_tobjects can now be formatted viastd::format(if available in your library). On platforms
wherewchar_tis UTF-16 or UTF-32 you can also use wide character formatting.sys_string_t::std_formatmethod. This formats a newsys_string_t(similar to the existingsys_string_t::format)
but usesstd::formatmachinery and formatting string syntax.- Range adapter closures:
as_utf8,as_utf18,as_utf32and genericas_utf<encoding>.- These can be used to create
utf_ref_view/utf_owning_viewfrom any range/view. For exampleas_utf16(std::string("abc")) - If you library supports custom adapter closures (usually
__cpp_lib_ranges >= 202202L) they can be used in
view pipelines likestd::string("abc") | as_utf16 | std::views::take(2)etc.
- These can be used to create
Fixed
- Printing
sys_string_tobjects intostd::ostream(andstd::wostreamif available) now functions correctly in presence
of stream formatting flags. Flags are currently ignored. This might change in a future version. - Printing/formatting
sys_string_tobjects that usecharstorage type now does not perform sanitizing transcoding. The content
of the string is printed as-is. This allows faithful round-tripping and support for invalid Unicode for those scenarios. Similar
behavior applies towchar_ton platform where it is UTF-16 or UTF-32. operator<<no longer pollutes global namespace