You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unlike previous versions, fmt 11.0 requires including fmt/ranges.h in order to use fmt::join. But including fmt/ranges.h breaks formatting Eigen types. This happens already in fmt 10.2.1, and maybe earlier versions, but since I could use fmt::join without #include <fmt/ranges.h> before, I didn't run into this problem. In that sense this is an incompatible change.
This is expected. If you provide a formatter for a range type you need to opt it out of range formatting rather than fiddle with includes: https://godbolt.org/z/3ercdas5z.
Thanks for the quick reply! Not that I would have expected this to be a range type, at least not a general matrix, but I'm aware that Eigen makes some unorthodox choices WRT iterators.
Here's what I settled on and placed next to the formatter. Maybe this is useful for someone who stumbles on this problem. Compared to Victor's version, it works also when not including ranges.h. The namespace macros are used to get the correctly versioned inline namespace. I'm using false_type because static constexpr const is a bit much for me to process :)
// Need to opt out of range formatting which id's Eigen::Matrix types as ranges if fmt/ranges.h is included.
FMT_BEGIN_NAMESPACE
// Forward declaration in case fmt/ranges.h is not included.
template <typename T, typename Char> struct is_range;
// ... and the opt-out.
template <typename T>
struct is_range<T,
std::enable_if_t<std::is_base_of_v<Eigen::EigenBase<T>, T>, char>>
: std::false_type
{};
FMT_END_NAMESPACE
Unlike previous versions, fmt 11.0 requires including
fmt/ranges.h
in order to usefmt::join
. But includingfmt/ranges.h
breaks formatting Eigen types. This happens already in fmt 10.2.1, and maybe earlier versions, but since I could usefmt::join
without#include <fmt/ranges.h>
before, I didn't run into this problem. In that sense this is an incompatible change.https://godbolt.org/z/Tz3bKWrMK
The text was updated successfully, but these errors were encountered: