mirror of
https://github.com/gabime/spdlog.git
synced 2024-11-15 16:35:45 +08:00
Merge pull request #2372 from kslattery/v1.x
C++14 build fixes for older gcc #2333
This commit is contained in:
commit
0ef5228a77
@ -262,15 +262,23 @@ struct my_type
|
|||||||
: i(i){};
|
: 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<>
|
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())
|
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()
|
void user_defined_example()
|
||||||
{
|
{
|
||||||
|
@ -8,8 +8,10 @@
|
|||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <spdlog/common.h>
|
#include <spdlog/common.h>
|
||||||
|
|
||||||
#if defined(__has_include) && __has_include(<version>)
|
#if defined(__has_include)
|
||||||
|
# if __has_include(<version>)
|
||||||
# include <version>
|
# include <version>
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __cpp_lib_span >= 202002L
|
#if __cpp_lib_span >= 202002L
|
||||||
|
Loading…
Reference in New Issue
Block a user