From f7e900e12e79ca1bd15ce5aea97fac26aadfdb48 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Fri, 19 Mar 2021 08:10:36 -0700 Subject: [PATCH] Simplify UDL definitions --- include/fmt/format.h | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 67810188..ada826f3 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -4033,7 +4033,7 @@ inline namespace literals { # pragma GCC diagnostic ignored "-Wgnu-string-literal-operator-template" # endif template -FMT_CONSTEXPR detail::udl_formatter operator""_format() { +constexpr detail::udl_formatter operator""_format() { return {}; } # pragma GCC diagnostic pop @@ -4048,12 +4048,12 @@ FMT_CONSTEXPR detail::udl_formatter operator""_format() { std::string message = "The answer is {}"_format(42); \endrst */ -FMT_CONSTEXPR inline detail::udl_formatter operator"" _format( - const char* s, size_t n) { +constexpr detail::udl_formatter operator"" _format(const char* s, + size_t n) { return {{s, n}}; } -FMT_CONSTEXPR inline detail::udl_formatter operator"" _format( - const wchar_t* s, size_t n) { +constexpr detail::udl_formatter operator"" _format(const wchar_t* s, + size_t n) { return {{s, n}}; } # endif // FMT_USE_UDL_TEMPLATE @@ -4068,12 +4068,10 @@ FMT_CONSTEXPR inline detail::udl_formatter operator"" _format( fmt::print("Elapsed time: {s:.2f} seconds", "s"_a=1.23); \endrst */ -FMT_CONSTEXPR inline detail::udl_arg operator"" _a(const char* s, - size_t) { +constexpr detail::udl_arg operator"" _a(const char* s, size_t) { return {s}; } -FMT_CONSTEXPR inline detail::udl_arg operator"" _a(const wchar_t* s, - size_t) { +constexpr detail::udl_arg operator"" _a(const wchar_t* s, size_t) { return {s}; } } // namespace literals