diff --git a/src/core/lib/gprpp/dump_args.h b/src/core/lib/gprpp/dump_args.h index 930cb2ca28a..c2b66ce2be3 100644 --- a/src/core/lib/gprpp/dump_args.h +++ b/src/core/lib/gprpp/dump_args.h @@ -26,13 +26,8 @@ namespace dump_args_detail { // Helper function... just ignore the initializer list passed into it. // Allows doing 'statements' via parameter pack expansion in C++11 - given // template : -// do_these_things({(foo(), 1)}); +// do_these_things({foo()...}); // will execute foo() for each T in Ts. -// In this example we also leverage the comma operator to make the resultant -// type of each statement be a consistant int so that C++ type deduction works -// as we'd like (note that in the expression (a, 1) in C++, the 'result' of the -// expression is the value after the right-most ',' -- in this case 1, with a -// executed as a side effect. template void do_these_things(std::initializer_list) {} @@ -45,7 +40,7 @@ class DumpArgs { {AddDumper([a = &args](std::ostream& os) { os << *a; })...}); } - friend std::ostream& operator<<(std::ostream& os, const DumpArgs& args); + friend std::ostream& operator<<(std::ostream& out, const DumpArgs& args); private: int AddDumper(absl::AnyInvocable dumper) { @@ -61,6 +56,7 @@ class DumpArgs { } // namespace grpc_core // Helper to print a list of variables and their values. +// Each type must be streamable to std::ostream. // Usage: // int a = 1; // int b = 2;