lib/fmt/PathFormatter: eliminate AllocatedPath specialization with std::convertible_to<Path>
This commit is contained in:
parent
7a4743d00e
commit
7198db758d
@ -1,24 +1,19 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Copyright The Music Player Daemon Project
|
||||
|
||||
#ifndef PATH_FORMATTER_HXX
|
||||
#define PATH_FORMATTER_HXX
|
||||
#pragma once
|
||||
|
||||
#include "fs/Path.hxx"
|
||||
#include "fs/AllocatedPath.hxx"
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
template<>
|
||||
struct fmt::formatter<Path> : formatter<string_view>
|
||||
#include <concepts>
|
||||
|
||||
template<std::convertible_to<Path> T>
|
||||
struct fmt::formatter<T> : formatter<string_view>
|
||||
{
|
||||
template<typename FormatContext>
|
||||
auto format(Path path, FormatContext &ctx) {
|
||||
return formatter<string_view>::format(path.ToUTF8(), ctx);
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct fmt::formatter<AllocatedPath> : formatter<Path> {};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user