OGS
FormattingUtils.h
Go to the documentation of this file.
1
11#pragma once
12
13#include <spdlog/fmt/bundled/ostream.h>
14#include <spdlog/fmt/bundled/ranges.h>
15
16#include <Eigen/Core>
17#include <concepts>
18
19#include "mathlib_export.h"
20
21namespace MathLib
22{
24{
25 static MATHLIB_EXPORT const Eigen::IOFormat full_precision;
26};
27} // namespace MathLib
28
29// disable fmt's range formatting for Eigen types
30template <typename T>
31 requires std::derived_from<T, Eigen::DenseBase<T>>
32struct fmt::is_range<T, char> : std::false_type
33{
34};
35
36template <typename T>
37 requires std::derived_from<T, Eigen::DenseBase<T>>
38struct fmt::formatter<T> : fmt::ostream_formatter
39{
40 auto format(T const& value, fmt::format_context& ctx) const
41 {
42 return fmt::ostream_formatter::format(
44 }
45};
#define MATHLIB_EXPORT
static MATHLIB_EXPORT const Eigen::IOFormat full_precision
auto format(T const &value, fmt::format_context &ctx) const