[gcc-7] Fix for dump-args (#36824)

Closes #36824

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36824 from ctiller:old-gcc 3b58efe98e
PiperOrigin-RevId: 640684291
pull/36785/head
Craig Tiller 6 months ago committed by Copybara-Service
parent 7105f93778
commit 242a83b6d8
  1. 10
      src/core/lib/gprpp/dump_args.h

@ -36,15 +36,15 @@ class DumpArgs {
template <typename... Args>
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<void(std::ostream&) const> dumper) {
arg_dumpers_.push_back(std::move(dumper));
template <typename T>
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
Loading…
Cancel
Save