Update fmt Formatters for Compatibility with Versions below 11 (#3172)

This commit is contained in:
Ahnaf Tahmid Chowdhury 2024-10-19 05:18:16 +06:00 committed by GitHub
parent c19b9b1beb
commit 82a6f9e40b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 6 deletions

View file

@ -76,10 +76,14 @@ struct formatter<std::array<T, 2>> {
}
template<typename FormatContext>
auto format(const std::array<T, 2>& arr, FormatContext& ctx) const
#if FMT_VERSION >= 110000 // Version 11.0.0 and above
auto format(const std::array<T, 2>& arr, FormatContext& ctx) const {
#else // For versions below 11.0.0
auto format(const std::array<T, 2>& arr, FormatContext& ctx)
{
#endif
return format_to(ctx.out(), "({}, {})", arr[0], arr[1]);
}
};
}
}; // namespace fmt
} // namespace fmt

View file

@ -221,12 +221,16 @@ namespace fmt {
template<>
struct formatter<openmc::Position> : formatter<std::string> {
template<typename FormatContext>
auto format(const openmc::Position& pos, FormatContext& ctx) const
#if FMT_VERSION >= 110000 // Version 11.0.0 and above
auto format(const openmc::Position& pos, FormatContext& ctx) const {
#else // For versions below 11.0.0
auto format(const openmc::Position& pos, FormatContext& ctx)
{
#endif
return formatter<std::string>::format(
fmt::format("({}, {}, {})", pos.x, pos.y, pos.z), ctx);
}
};
}
}; // namespace fmt
} // namespace fmt