add fmt:: namespace to distinguish from std::format_to (#43)

When compiled with new toolchain that implements std::format_to, it become
ambiguous on which one should be called. Due to argument-dependent lookup, even
if we are not `using namespace std;` the std version is still considered. So
let's add fmt:: to avoid ambiguous compilation error.
This commit is contained in:
胡玮文
2025-03-03 08:07:52 +08:00
committed by GitHub
parent 309a258ac2
commit 165f09a7b4
13 changed files with 56 additions and 56 deletions

View File

@@ -139,7 +139,7 @@ template <>
struct formatter<hf3fs::meta::client::ServerSelectionStrategy::NodeInfo> : formatter<std::string_view> {
template <typename FormatContext>
auto format(const hf3fs::meta::client::ServerSelectionStrategy::NodeInfo &node, FormatContext &ctx) const {
return format_to(ctx.out(), "[{}]@{}.{}", node.address, node.nodeId, node.hostname);
return fmt::format_to(ctx.out(), "[{}]@{}.{}", node.address, node.nodeId, node.hostname);
}
};

View File

@@ -578,15 +578,15 @@ template <>
struct formatter<hf3fs::storage::client::RoutingTarget> : formatter<std::string_view> {
template <typename FormatContext>
auto format(const hf3fs::storage::client::RoutingTarget &routingTarget, FormatContext &ctx) const {
return format_to(ctx.out(),
"{}@{}@{}:{}@{}:{}#{}",
routingTarget.chainId,
routingTarget.chainVer,
routingTarget.routingInfoVer,
routingTarget.targetInfo.targetId,
routingTarget.targetInfo.nodeId,
routingTarget.channel.id,
routingTarget.channel.seqnum);
return fmt::format_to(ctx.out(),
"{}@{}@{}:{}@{}:{}#{}",
routingTarget.chainId,
routingTarget.chainVer,
routingTarget.routingInfoVer,
routingTarget.targetInfo.targetId,
routingTarget.targetInfo.nodeId,
routingTarget.channel.id,
routingTarget.channel.seqnum);
}
};