After updating my project vom fmt::v8 to fmt::v10 I get a conversion error during building in the formatter apparently. To be clear, this worked flawlessly in fmt::v8.
std::ostream& operator<<(
std::ostream& os, MyDataType const& parameters)
{
os << fmt::to_string(parameters);
return os;
}
throws now
Error C2662 'auto fmt::v10::formatter<..>::format<FormatContext>(..)': cannot convert 'this' pointer from 'const fmt::v10::formatter<..>' to 'fmt::v10::formatter<..> &'
I also found this but don't understand it
template<>
struct fmt::formatter<MyDataType>
: formatter<std::unordered_map<std::string, std::string>> {
template<typename FormatContext>
auto format(MyDataType const& parameters, FormatContext& ctx)
{
auto iter = ctx.out();
return fmt::format_to(
iter,
"MyDataType("
"{{Type, {}}})",
static_cast<int>(parameters.type));
}
};