Skip to content

Commit

Permalink
fix: use different syntax for opening namespace for custom formatters
Browse files Browse the repository at this point in the history
  • Loading branch information
jackgerrits committed Feb 1, 2022
1 parent d5b709d commit 57e8ff2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
9 changes: 6 additions & 3 deletions vowpalwabbit/automl.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,10 @@ size_t write_model_field(io_buf&, const VW::automl::interaction_config_manager&,
} // namespace model_utils
} // namespace VW

namespace fmt
{
template <>
struct fmt::formatter<VW::automl::automl_state> : formatter<std::string>
struct formatter<VW::automl::automl_state> : formatter<std::string>
{
auto format(VW::automl::automl_state c, format_context& ctx) -> decltype(ctx.out())
{
Expand All @@ -198,10 +200,11 @@ struct fmt::formatter<VW::automl::automl_state> : formatter<std::string>
};

template <>
struct fmt::formatter<VW::automl::config_state> : formatter<std::string>
struct formatter<VW::automl::config_state> : formatter<std::string>
{
auto format(VW::automl::config_state c, format_context& ctx) -> decltype(ctx.out())
{
return formatter<std::string>::format(std::string{VW::to_string(c)}, ctx);
}
};
};
} // namespace fmt
5 changes: 4 additions & 1 deletion vowpalwabbit/ccb_label.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,14 @@ size_t write_model_field(io_buf&, const CCB::label&, const std::string&, bool);
} // namespace model_utils
} // namespace VW

namespace fmt
{
template <>
struct fmt::formatter<CCB::example_type> : formatter<std::string>
struct formatter<CCB::example_type> : formatter<std::string>
{
auto format(CCB::example_type c, format_context& ctx) -> decltype(ctx.out())
{
return formatter<std::string>::format(std::string{VW::to_string(c)}, ctx);
}
};
} // namespace fmt
7 changes: 5 additions & 2 deletions vowpalwabbit/slates_label.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,14 @@ size_t write_model_field(io_buf&, const VW::slates::label&, const std::string&,
} // namespace model_utils
} // namespace VW

namespace fmt
{
template <>
struct fmt::formatter<VW::slates::example_type> : formatter<std::string>
struct formatter<VW::slates::example_type> : formatter<std::string>
{
auto format(VW::slates::example_type c, format_context& ctx) -> decltype(ctx.out())
{
return formatter<std::string>::format(std::string{VW::to_string(c)}, ctx);
}
};
};
} // namespace fmt

0 comments on commit 57e8ff2

Please sign in to comment.