fmt::print("{}", std::optional<const int>{}); doesn't compile. Below is my initial analysis (I'm not really familiar with fmt internals):
is_formattable<std::optional<const int>> is false because
has_formatter is false because
decltype(formatter<U, Char>().format(*p, *ctx), std::true_type()) is SFINAEd out because
formatter<U, Char>() is invalid because
- default ctor for
formatter<std::optional<const int>> is deleted because
- default ctor for
formatter<T, Char> underlying_ here is deleted because
- default ctor for
formatter<const int> is deleted here probably because
native_formatter is not selected because type_constant<const int>::value is custom_type instead of int_type
I can only guess that remove_cv_t is required somewhere in that chain.
fmt::print("{}", std::optional<const int>{});doesn't compile. Below is my initial analysis (I'm not really familiar withfmtinternals):is_formattable<std::optional<const int>>isfalsebecausehas_formatterisfalsebecausedecltype(formatter<U, Char>().format(*p, *ctx), std::true_type())is SFINAEd out becauseformatter<U, Char>()is invalid becauseformatter<std::optional<const int>>is deleted becauseformatter<T, Char> underlying_here is deleted becauseformatter<const int>is deleted here probably becausenative_formatteris not selected becausetype_constant<const int>::valueiscustom_typeinstead ofint_typeI can only guess that
remove_cv_tis required somewhere in that chain.