Skip to content

Commit

Permalink
Add formatter for std::filesystem::path.
Browse files Browse the repository at this point in the history
  • Loading branch information
Holt59 committed Jun 30, 2024
1 parent 2f39b59 commit 1d56414
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/formatters.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include "./formatters/enums.h"
#include "./formatters/path.h"
#include "./formatters/qt.h"
#include "./formatters/random_access_containers.h"
#include "./formatters/strings.h"
#include "./formatters/strings.h"
17 changes: 17 additions & 0 deletions src/formatters/path.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#pragma once

#include <filesystem>
#include <format>
#include <type_traits>

template <class CharT>
struct std::formatter<std::filesystem::path, CharT>
: std::formatter<std::filesystem::path::string_type, CharT>
{
template <class FmtContext>
FmtContext::iterator format(const std::filesystem::path& v, FmtContext& ctx) const
{
return std::formatter<std::filesystem::path::string_type, CharT>::format(v.native(),
ctx);
}
};

0 comments on commit 1d56414

Please sign in to comment.