Skip to content

Commit 472945b

Browse files
authored
Fix shadow member warning in example file (#3521)
1 parent 687226d commit 472945b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

example/example.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -267,24 +267,24 @@ void multi_sink_example() {
267267

268268
// User defined types logging
269269
struct my_type {
270-
int i = 0;
271-
explicit my_type(int i)
272-
: i(i) {}
270+
int value_ = 0;
271+
explicit my_type(int value)
272+
: value_(value) {}
273273
};
274274

275275
#ifndef SPDLOG_USE_STD_FORMAT // when using fmtlib
276276
template <>
277277
struct fmt::formatter<my_type> : fmt::formatter<std::string> {
278278
auto format(my_type my, format_context &ctx) const -> decltype(ctx.out()) {
279-
return fmt::format_to(ctx.out(), "[my_type i={}]", my.i);
279+
return fmt::format_to(ctx.out(), "[my_type value={}]", my.value_);
280280
}
281281
};
282282

283283
#else // when using std::format
284284
template <>
285285
struct std::formatter<my_type> : std::formatter<std::string> {
286286
auto format(my_type my, format_context &ctx) const -> decltype(ctx.out()) {
287-
return std::format_to(ctx.out(), "[my_type i={}]", my.i);
287+
return std::format_to(ctx.out(), "[my_type value={}]", my.value_);
288288
}
289289
};
290290
#endif

0 commit comments

Comments
 (0)