Merge pull request #2372 from kslattery/v1.x

C++14 build fixes for older gcc #2333
This commit is contained in:
Gabi Melman 2022-05-13 11:01:19 +03:00 committed by GitHub
commit 0ef5228a77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 5 deletions

View File

@ -262,15 +262,23 @@ struct my_type
: i(i){};
};
namespace fmt_lib = spdlog::fmt_lib;
// Using a namespace alias like fmt_lib is not allowed when extending an existing namespace,
// but the correct namespace can still be selected with the SPDLOG_USE_STD_FORMAT macro.
#ifdef SPDLOG_USE_STD_FORMAT
namespace std {
#else
namespace fmt {
#endif
template<>
struct fmt_lib::formatter<my_type> : fmt_lib::formatter<std::string>
struct formatter<my_type> : formatter<std::string>
{
auto format(my_type my, format_context &ctx) -> decltype(ctx.out())
{
return fmt_lib::format_to(ctx.out(), "[my_type i={}]", my.i);
return format_to(ctx.out(), "[my_type i={}]", my.i);
}
};
}
void user_defined_example()
{

View File

@ -8,8 +8,10 @@
#include <cctype>
#include <spdlog/common.h>
#if defined(__has_include) && __has_include(<version>)
# include <version>
#if defined(__has_include)
# if __has_include(<version>)
# include <version>
# endif
#endif
#if __cpp_lib_span >= 202002L