10#include <Eigen/SparseCore>
17template <
typename Derived,
typename CharT>
18 requires std::derived_from<Derived, Eigen::DenseBase<Derived>> ||
19 std::derived_from<Derived, Eigen::SparseCompressedBase<Derived>>
20struct fmt::formatter<Derived, CharT> {
21 template <
typename ParseContext>
22 constexpr auto parse(ParseContext& ctx) {
23 return m_underlying.parse(ctx);
26 template <
typename FmtContext>
27 auto format(
const Derived& mat, FmtContext& ctx)
const {
30 for (
int row = 0; row < mat.rows(); ++row) {
31 for (
int col = 0; col < mat.cols(); ++col) {
33 out = m_underlying.format(mat.coeff(row, col), ctx);
36 if (row < mat.rows() - 1) {
45 fmt::formatter<typename Derived::Scalar, CharT> m_underlying;
auto format_to(OutputIt out, wformat_string< T... > fmt, T &&... args) -> OutputIt
Definition: xchar.h:142