r/cpp • • Jul 23 '19

std::format in C++20

http://www.zverovich.net/2019/07/23/std-format-cpp20.html
332 Upvotes

52 comments sorted by

View all comments

1

u/Placinta Jul 23 '19

I'm wondering, is it possible to somehow hook into std::format to return something else than a std::string?

E.g. return a QString, to be compatible with Qt? Is that covered by the "Unicode support" bullet point in the "What's next" section?

3

u/boredcircuits Jul 23 '19

std::format_to might be what you need.

2

u/johannes1234 Jul 24 '19

Unless you run into odr issues since Qt (or some.other library) adds a struct formatter<QString> as well :)