Skip to content

Commit

Permalink
#2216: Fix compile errors when using newer fmt version
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobDomagala committed Apr 30, 2024
1 parent 3585c71 commit 4a64c6e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
7 changes: 5 additions & 2 deletions src/vt/rdma/rdma_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ static constexpr ByteType rdma_default_byte_size = sizeof(char);
VT_FMT_NAMESPACE_BEGIN

template <>
struct formatter<::vt::rdma::Type> : formatter<std::string_view> {
struct formatter<::vt::rdma::Type> {
constexpr auto parse(fmt::format_parse_context& ctx) { return ctx.begin(); }

template <typename FormatContext>
auto format(::vt::rdma::Type t, FormatContext& ctx) const {
std::string_view name = "Unknown";
Expand All @@ -141,7 +143,8 @@ struct formatter<::vt::rdma::Type> : formatter<std::string_view> {
name = fmt::format(
"{}", static_cast<std::underlying_type_t<::vt::rdma::Type>>(t));
}
return formatter<std::string_view>::format(name, ctx);

return fmt::format_to(ctx.out(), name);
}
};

Expand Down
10 changes: 5 additions & 5 deletions src/vt/topos/index/dense/dense_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,14 @@ static_assert(
VT_FMT_NAMESPACE_BEGIN

template <typename IndexType, ::vt::index::NumDimensionsType ndim>
struct formatter<::vt::index::DenseIndexArray<IndexType, ndim>>
: formatter<std::string> {
struct formatter<::vt::index::DenseIndexArray<IndexType, ndim>> {
constexpr auto parse(fmt::format_parse_context& ctx) { return ctx.begin(); }

template <typename FormatContext>
auto format(
const ::vt::index::DenseIndexArray<IndexType, ndim>& idx,
FormatContext& ctx
) const {
return formatter<std::string>::format(idx.toString(), ctx);
FormatContext& ctx) const {
return fmt::format_to(ctx.out(), idx.toString());
}
};

Expand Down
7 changes: 4 additions & 3 deletions src/vt/vrt/collection/balance/temperedlb/criterion.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ struct Criterion {
VT_FMT_NAMESPACE_BEGIN

template <>
struct formatter<::vt::vrt::collection::lb::CriterionEnum>
: formatter<std::string_view> {
struct formatter<::vt::vrt::collection::lb::CriterionEnum> {
constexpr auto parse(fmt::format_parse_context& ctx) { return ctx.begin(); }

template <typename FormatContext>
auto format(::vt::vrt::collection::lb::CriterionEnum c, FormatContext& ctx) const {
std::string_view name = "Unknown";
Expand All @@ -109,7 +110,7 @@ struct formatter<::vt::vrt::collection::lb::CriterionEnum>
name = "ModifiedGrapevine";
break;
}
return formatter<string_view>::format(name, ctx);
return fmt::format_to(ctx.out(), name);
}
};

Expand Down
6 changes: 4 additions & 2 deletions tests/unit/lb/test_lbargs_enum_conv.nompi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ TEST_F(TestLBArgsEnumConverter, test_enum_converter_config) {

VT_FMT_NAMESPACE_BEGIN
template <>
struct formatter<::vt::tests::unit::DummyEnum> : formatter<std::string_view> {
struct formatter<::vt::tests::unit::DummyEnum> {
constexpr auto parse(fmt::format_parse_context& ctx) { return ctx.begin(); }

template <typename FormatContext>
auto format(::vt::tests::unit::DummyEnum c, FormatContext& ctx) const {
std::string_view name = "Unknown";
Expand All @@ -165,7 +167,7 @@ VT_FMT_NAMESPACE_BEGIN
name = "Three";
break;
}
return formatter<string_view>::format(name, ctx);
return fmt::format_to(ctx.out(), name);
}
};
VT_FMT_NAMESPACE_END

0 comments on commit 4a64c6e

Please sign in to comment.