compatible for c++11 but GCC < 5

This commit is contained in:
Aengus.Jiang 2025-06-27 10:39:23 +08:00
parent 353bd895a2
commit f40f93a40d

View File

@ -73,6 +73,12 @@
# endif
#endif // FMT_MODULE
#if (defined(__GNUC__) && __GNUC__ < 5) || defined(_MSC_VER)
# define OPERATOR_LITERAL(suffix) operator"" suffix
#else
# define OPERATOR_LITERAL(suffix) operator""suffix
#endif
#if defined(FMT_USE_NONTYPE_TEMPLATE_ARGS)
// Use the provided definition.
#elif defined(__NVCOMPILER)
@ -4050,7 +4056,7 @@ template <typename T, typename Char = char> struct nested_formatter {
inline namespace literals {
#if FMT_USE_NONTYPE_TEMPLATE_ARGS
template <detail::fixed_string S> constexpr auto operator""_a() {
template <detail::fixed_string S> constexpr auto OPERATOR_LITERAL(_a)() {
using char_t = remove_cvref_t<decltype(*S.data)>;
return detail::udl_arg<char_t, sizeof(S.data) / sizeof(char_t), S>();
}
@ -4063,7 +4069,7 @@ template <detail::fixed_string S> constexpr auto operator""_a() {
* using namespace fmt::literals;
* fmt::print("The answer is {answer}.", "answer"_a=42);
*/
constexpr auto operator""_a(const char* s, size_t) -> detail::udl_arg<char> {
constexpr auto OPERATOR_LITERAL(_a)(const char* s, size_t) -> detail::udl_arg<char> {
return {s};
}
#endif // FMT_USE_NONTYPE_TEMPLATE_ARGS