Simplify UDL definitions

This commit is contained in:
Victor Zverovich 2021-03-19 08:10:36 -07:00
parent d9661c8f3b
commit f7e900e12e

View File

@ -4033,7 +4033,7 @@ inline namespace literals {
# pragma GCC diagnostic ignored "-Wgnu-string-literal-operator-template" # pragma GCC diagnostic ignored "-Wgnu-string-literal-operator-template"
# endif # endif
template <typename Char, Char... CHARS> template <typename Char, Char... CHARS>
FMT_CONSTEXPR detail::udl_formatter<Char, CHARS...> operator""_format() { constexpr detail::udl_formatter<Char, CHARS...> operator""_format() {
return {}; return {};
} }
# pragma GCC diagnostic pop # pragma GCC diagnostic pop
@ -4048,12 +4048,12 @@ FMT_CONSTEXPR detail::udl_formatter<Char, CHARS...> operator""_format() {
std::string message = "The answer is {}"_format(42); std::string message = "The answer is {}"_format(42);
\endrst \endrst
*/ */
FMT_CONSTEXPR inline detail::udl_formatter<char> operator"" _format( constexpr detail::udl_formatter<char> operator"" _format(const char* s,
const char* s, size_t n) { size_t n) {
return {{s, n}}; return {{s, n}};
} }
FMT_CONSTEXPR inline detail::udl_formatter<wchar_t> operator"" _format( constexpr detail::udl_formatter<wchar_t> operator"" _format(const wchar_t* s,
const wchar_t* s, size_t n) { size_t n) {
return {{s, n}}; return {{s, n}};
} }
# endif // FMT_USE_UDL_TEMPLATE # endif // FMT_USE_UDL_TEMPLATE
@ -4068,12 +4068,10 @@ FMT_CONSTEXPR inline detail::udl_formatter<wchar_t> operator"" _format(
fmt::print("Elapsed time: {s:.2f} seconds", "s"_a=1.23); fmt::print("Elapsed time: {s:.2f} seconds", "s"_a=1.23);
\endrst \endrst
*/ */
FMT_CONSTEXPR inline detail::udl_arg<char> operator"" _a(const char* s, constexpr detail::udl_arg<char> operator"" _a(const char* s, size_t) {
size_t) {
return {s}; return {s};
} }
FMT_CONSTEXPR inline detail::udl_arg<wchar_t> operator"" _a(const wchar_t* s, constexpr detail::udl_arg<wchar_t> operator"" _a(const wchar_t* s, size_t) {
size_t) {
return {s}; return {s};
} }
} // namespace literals } // namespace literals