In case anyone is curious how to implement support for <format> in boost::string_view by delegating to the formatter for std::string_view: https://godbolt.org/z/YsWKrEz3P On 04/11/2025 16:41, Ruben Perez via Boost wrote:
I use core::string_view in Boost.MySQL, too, because implicit conversion to std::string_view is super important for me. core::string_view has std::format support, too. Not having any of these would have forced me to upgrade to C++17 already. So I'd like to see core::string_view as a public type, as it's already widely used in our interfaces. For the record, the problem with not having explicit std::format support is specially hostile for users because the problem manifests at runtime rather than compile-time. Since XXX::string_view is a range, it will be formatted as a range of characters instead of a string. You can see what it looks like here: https://godbolt.org/z/W7acqxYWd
Copying a snippet here just in case:
std::println("{}", std::string_view("hello world")); std::println("{}", boost::core::string_view("hello world")); std::println("{}", boost::string_view("hello world"));
Prints:
hello world hello world ['h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd'] _______________________________________________ Boost mailing list -- boost@lists.boost.org To unsubscribe send an email to boost-leave@lists.boost.org https://lists.boost.org/mailman3/lists/boost.lists.boost.org/ Archived at: https://lists.boost.org/archives/list/boost@lists.boost.org/message/LGBW4G4F...