diff --git a/src/core/lib/gprpp/dump_args.h b/src/core/lib/gprpp/dump_args.h index c2b66ce2be3..abd5b6a2027 100644 --- a/src/core/lib/gprpp/dump_args.h +++ b/src/core/lib/gprpp/dump_args.h @@ -36,15 +36,15 @@ class DumpArgs { template explicit DumpArgs(const char* arg_string, const Args&... args) : arg_string_(arg_string) { - do_these_things( - {AddDumper([a = &args](std::ostream& os) { os << *a; })...}); + do_these_things({AddDumper(&args)...}); } friend std::ostream& operator<<(std::ostream& out, const DumpArgs& args); private: - int AddDumper(absl::AnyInvocable dumper) { - arg_dumpers_.push_back(std::move(dumper)); + template + int AddDumper(T* p) { + arg_dumpers_.push_back([p](std::ostream& os) { os << *p; }); return 0; } @@ -66,4 +66,4 @@ class DumpArgs { #define GRPC_DUMP_ARGS(...) \ grpc_core::dump_args_detail::DumpArgs(#__VA_ARGS__, __VA_ARGS__) -#endif // GRPC_SRC_CORE_LIB_GPRPP_DUMP_ARGS_H +#endif // GRPC_SRC_CORE_LIB_GPRPP_DUMP_ARGS_H \ No newline at end of file