Commit 03b1b283 authored by Vladislav Shchapov's avatar Vladislav Shchapov Committed by Victor Zverovich

Improve std::filesystem::path formatter.

Signed-off-by: default avatarVladislav Shchapov <vladislav@shchapov.ru>
parent 4f9311e6
......@@ -19,14 +19,9 @@
#ifdef __cpp_lib_filesystem
# include <filesystem>
template <>
struct fmt::formatter<std::filesystem::path> : formatter<string_view> {
template <typename FormatContext>
auto format(const std::filesystem::path& p, FormatContext& ctx) const ->
typename FormatContext::iterator {
return formatter<string_view>::format(p.string(), ctx);
}
};
FMT_BEGIN_NAMESPACE
template <> struct formatter<std::filesystem::path> : ostream_formatter {};
FMT_END_NAMESPACE
#endif
FMT_BEGIN_NAMESPACE
......
......@@ -11,7 +11,7 @@
TEST(std_test, path) {
#ifdef __cpp_lib_filesystem
EXPECT_EQ(fmt::format("{:8}", std::filesystem::path("foo")), "foo ");
EXPECT_EQ(fmt::format("{:8}", std::filesystem::path("foo")), "\"foo\" ");
#endif
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment