mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-25 15:21:54 +00:00
Fix path formatter
This commit is contained in:
parent
f0903ad9df
commit
9730fb0156
@ -8,22 +8,23 @@
|
||||
#ifndef FMT_STD_H_
|
||||
#define FMT_STD_H_
|
||||
|
||||
#include <version>
|
||||
#include "format.h"
|
||||
|
||||
#if FMT_HAS_INCLUDE(<version>)
|
||||
# include <version>
|
||||
#endif
|
||||
|
||||
#ifdef __cpp_lib_filesystem
|
||||
# include <filesystem>
|
||||
|
||||
namespace fmt {
|
||||
|
||||
template <> struct formatter<std::filesystem::path> : formatter<string_view> {
|
||||
template <>
|
||||
struct fmt::formatter<std::filesystem::path> : formatter<string_view> {
|
||||
template <typename FormatContext>
|
||||
auto format(const path& p, FormatContext& ctx) const ->
|
||||
auto format(const std::filesystem::path& p, FormatContext& ctx) const ->
|
||||
typename FormatContext::iterator {
|
||||
return formatter<string_view>::format(p.string(), ctx);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace fmt
|
||||
#endif
|
||||
|
||||
#endif // FMT_STD_H_
|
||||
|
@ -77,6 +77,7 @@ endif()
|
||||
add_fmt_test(printf-test)
|
||||
add_fmt_test(ranges-test ranges-odr-test.cc)
|
||||
add_fmt_test(scan-test)
|
||||
add_fmt_test(std-test)
|
||||
add_fmt_test(unicode-test HEADER_ONLY)
|
||||
if (MSVC)
|
||||
target_compile_options(unicode-test PRIVATE /utf-8)
|
||||
|
Loading…
Reference in New Issue
Block a user