diff --git a/src/core/include/mp-units/bits/external/fixed_string.h b/src/core/include/mp-units/bits/external/fixed_string.h index 0e97c20c..d595f907 100644 --- a/src/core/include/mp-units/bits/external/fixed_string.h +++ b/src/core/include/mp-units/bits/external/fixed_string.h @@ -29,6 +29,7 @@ // IWYU pragma: begin_exports #include #include +#include // IWYU pragma: end_exports #include @@ -121,6 +122,13 @@ struct basic_fixed_string { // TODO std::lexicographical_compare_three_way(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); return detail::lexicographical_compare_three_way(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); } + + template + friend std::basic_ostream& operator<<(std::basic_ostream& os, + const basic_fixed_string& str) + { + return os << str.c_str(); + } }; template @@ -136,3 +144,12 @@ template using fixed_string = basic_fixed_string; } // namespace mp_units + +template +struct MP_UNITS_STD_FMT::formatter> : formatter> { + template + auto format(const mp_units::basic_fixed_string& str, FormatContext& ctx) + { + return formatter>::format(str.view(), ctx); + } +};