format.hpp 444 B

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