Skip to content

Commit b800102

Browse files
committed
Add formatter for std::filesystem::path.
1 parent 694a9ba commit b800102

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

src/formatters.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22

33
#include "./formatters/enums.h"
4+
#include "./formatters/path.h"
45
#include "./formatters/qt.h"
56
#include "./formatters/random_access_containers.h"
6-
#include "./formatters/strings.h"
7+
#include "./formatters/strings.h"

src/formatters/path.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#pragma once
2+
3+
#include <filesystem>
4+
#include <format>
5+
#include <type_traits>
6+
7+
template <class CharT>
8+
struct std::formatter<std::filesystem::path, CharT>
9+
: std::formatter<std::filesystem::path::string_type, CharT>
10+
{
11+
template <class FmtContext>
12+
FmtContext::iterator format(const std::filesystem::path& v, FmtContext& ctx) const
13+
{
14+
return std::formatter<std::filesystem::path::string_type, CharT>::format(v.native(),
15+
ctx);
16+
}
17+
};

0 commit comments

Comments
 (0)