From 65045a7975278b08242824fee8aa4d0d151a7ce6 Mon Sep 17 00:00:00 2001 From: sunmy <7743179+sun_mengyue@user.noreply.gitee.com> Date: Wed, 9 Jun 2021 22:22:03 +0800 Subject: [PATCH] add inline to statc constexpr --- include/fmt/chrono.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/include/fmt/chrono.h b/include/fmt/chrono.h index cf3bd08c..02896741 100644 --- a/include/fmt/chrono.h +++ b/include/fmt/chrono.h @@ -458,7 +458,8 @@ struct formatter, auto end = it; while (end != ctx.end() && *end != '}') ++end; if (end == it) - this->specs = {default_spec, 17}; + this->specs = {default_spec, + std::end(default_spec) - std::begin(default_spec)}; else this->specs = {it, detail::to_unsigned(end - it)}; return end; @@ -470,10 +471,10 @@ struct formatter, std::tm time = localtime(val); return formatter::format(time, ctx); } - - static constexpr Char default_spec[] = {'%', 'Y', '-', '%', 'm', '-', - '%', 'd', ' ', '%', 'H', ':', - '%', 'M', ':', '%', 'S'}; + + static constexpr inline Char default_spec[] = {'%', 'Y', '-', '%', 'm', '-', + '%', 'd', ' ', '%', 'H', ':', + '%', 'M', ':', '%', 'S'}; }; template struct formatter {