From 5bdce181f1222b7651cb1d6b307deb7762696f33 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sat, 9 Sep 2023 08:16:45 -0700 Subject: [PATCH] Mark styled_arg as a view to prevent lifetime issues --- include/fmt/color.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/fmt/color.h b/include/fmt/color.h index 8697e1ca..57b7f578 100644 --- a/include/fmt/color.h +++ b/include/fmt/color.h @@ -427,9 +427,10 @@ template inline void reset_color(buffer& buffer) { buffer.append(reset_color.begin(), reset_color.end()); } -template struct styled_arg { +template struct styled_arg : detail::view { const T& value; text_style style; + styled_arg(const T& v, text_style s) : value(v), style(s) {} }; template