mirror of
https://github.com/gabime/spdlog.git
synced 2026-04-10 11:34:29 +08:00
Fix shadow member warning in example file (#3521)
This commit is contained in:
@@ -267,16 +267,16 @@ void multi_sink_example() {
|
|||||||
|
|
||||||
// User defined types logging
|
// User defined types logging
|
||||||
struct my_type {
|
struct my_type {
|
||||||
int i = 0;
|
int value_ = 0;
|
||||||
explicit my_type(int i)
|
explicit my_type(int value)
|
||||||
: i(i) {}
|
: value_(value) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef SPDLOG_USE_STD_FORMAT // when using fmtlib
|
#ifndef SPDLOG_USE_STD_FORMAT // when using fmtlib
|
||||||
template <>
|
template <>
|
||||||
struct fmt::formatter<my_type> : fmt::formatter<std::string> {
|
struct fmt::formatter<my_type> : fmt::formatter<std::string> {
|
||||||
auto format(my_type my, format_context &ctx) const -> decltype(ctx.out()) {
|
auto format(my_type my, format_context &ctx) const -> decltype(ctx.out()) {
|
||||||
return fmt::format_to(ctx.out(), "[my_type i={}]", my.i);
|
return fmt::format_to(ctx.out(), "[my_type value={}]", my.value_);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -284,7 +284,7 @@ struct fmt::formatter<my_type> : fmt::formatter<std::string> {
|
|||||||
template <>
|
template <>
|
||||||
struct std::formatter<my_type> : std::formatter<std::string> {
|
struct std::formatter<my_type> : std::formatter<std::string> {
|
||||||
auto format(my_type my, format_context &ctx) const -> decltype(ctx.out()) {
|
auto format(my_type my, format_context &ctx) const -> decltype(ctx.out()) {
|
||||||
return std::format_to(ctx.out(), "[my_type i={}]", my.i);
|
return std::format_to(ctx.out(), "[my_type value={}]", my.value_);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user