support std::optional holding cv-qualified types (#4562)

Fixes #4561
This commit is contained in:
Oleksandr Koval
2025-10-03 14:40:44 +03:00
committed by GitHub
parent 27ea09836a
commit 486e7ba579
2 changed files with 2 additions and 1 deletions

View File

@@ -353,7 +353,7 @@ template <typename T, typename Char>
struct formatter<std::optional<T>, Char,
std::enable_if_t<is_formattable<T, Char>::value>> {
private:
formatter<T, Char> underlying_;
formatter<std::remove_cv_t<T>, Char> underlying_;
static constexpr basic_string_view<Char> optional =
detail::string_literal<Char, 'o', 'p', 't', 'i', 'o', 'n', 'a', 'l',
'('>{};