Details
-
Task
-
Resolution: Unresolved
-
P2: Important
-
None
-
None
-
None
Description
If we decide to provide std::format support for Qt classes, we might want to think of a way to simplify this work to Qt module maintainters.
Similarly to C++20 comparison, we might want to provide helper macros. These macros might provide the necessary std::formatter<T, CharT> specializations, and just require the user to provide some helper function that will be used by std::formatter::format().
In the most trivial case, if we support only the default formatting string "{}", the function can be as simple as:
friend std::string toString(const MyType &t);
Technically, we could even use the qDebug() streaming operators, because after https://codereview.qt-project.org/c/qt/qtbase/+/577581 gets merged, we would avoid an unnecessary UTF-16 string.