mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-27 21:31:20 +00:00
format: do not use udl_{arg,formatter} return types when UDL is not in use
The udl_{arg,formatter} structs are only defined when FMT_USE_USER_DEFINED_LITERALS is set, so don't try to define things that return that struct when it's not defined.
This commit is contained in:
parent
3bd806f12f
commit
c9a10631cb
@ -2730,6 +2730,8 @@ extern template auto snprintf_float<long double>(long double value,
|
|||||||
#endif // FMT_HEADER_ONLY
|
#endif // FMT_HEADER_ONLY
|
||||||
|
|
||||||
FMT_END_DETAIL_NAMESPACE
|
FMT_END_DETAIL_NAMESPACE
|
||||||
|
|
||||||
|
#if FMT_USE_USER_DEFINED_LITERALS
|
||||||
inline namespace literals {
|
inline namespace literals {
|
||||||
/**
|
/**
|
||||||
\rst
|
\rst
|
||||||
@ -2741,18 +2743,18 @@ inline namespace literals {
|
|||||||
fmt::print("Elapsed time: {s:.2f} seconds", "s"_a=1.23);
|
fmt::print("Elapsed time: {s:.2f} seconds", "s"_a=1.23);
|
||||||
\endrst
|
\endrst
|
||||||
*/
|
*/
|
||||||
#if FMT_USE_NONTYPE_TEMPLATE_PARAMETERS
|
# if FMT_USE_NONTYPE_TEMPLATE_PARAMETERS
|
||||||
template <detail_exported::fixed_string Str>
|
template <detail_exported::fixed_string Str>
|
||||||
constexpr auto operator""_a()
|
constexpr auto operator""_a()
|
||||||
-> detail::udl_arg<remove_cvref_t<decltype(Str.data[0])>,
|
-> detail::udl_arg<remove_cvref_t<decltype(Str.data[0])>,
|
||||||
sizeof(Str.data) / sizeof(decltype(Str.data[0])), Str> {
|
sizeof(Str.data) / sizeof(decltype(Str.data[0])), Str> {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
#else
|
# else
|
||||||
constexpr auto operator"" _a(const char* s, size_t) -> detail::udl_arg<char> {
|
constexpr auto operator"" _a(const char* s, size_t) -> detail::udl_arg<char> {
|
||||||
return {s};
|
return {s};
|
||||||
}
|
}
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\rst
|
\rst
|
||||||
@ -2769,6 +2771,7 @@ constexpr auto operator"" _format(const char* s, size_t n)
|
|||||||
return {{s, n}};
|
return {{s, n}};
|
||||||
}
|
}
|
||||||
} // namespace literals
|
} // namespace literals
|
||||||
|
#endif // FMT_USE_USER_DEFINED_LITERALS
|
||||||
|
|
||||||
template <typename Locale, FMT_ENABLE_IF(detail::is_locale<Locale>::value)>
|
template <typename Locale, FMT_ENABLE_IF(detail::is_locale<Locale>::value)>
|
||||||
inline auto vformat(const Locale& loc, string_view fmt, format_args args)
|
inline auto vformat(const Locale& loc, string_view fmt, format_args args)
|
||||||
|
Loading…
Reference in New Issue
Block a user