| 1 | #ifndef FORMAT_HPP |
| 2 | |
| 3 | #if __cplusplus >= 202002L |
| 4 | // available as of gcc-13 |
| 5 | // also requires/checks the above guard on C++20 |
| 6 | |
| 7 | #include <format> |
| 8 | #include <string_view> |
| 9 | |
| 10 | namespace fmt |
| 11 | { |
| 12 | template<typename... Args> |
| 13 | inline std::string |
| 14 | format(std::string_view format, Args &&...args) |
| 15 | { |
| 16 | return std::vformat(format, std::make_format_args(args...)); |
| 17 | } |
| 18 | } // namespace fmt |
| 19 | |
| 20 | #else |
| 21 | // use original fmtlib |
| 22 | #include <fmt/format.h> |
| 23 | #endif |
| 24 | |
| 25 | #endif // FORMAT_HPP |