MCPcopy Create free account
hub / github.com/andreasfertig/cppinsights / ForEachArg

Method ForEachArg

OutputFormatHelper.h:219–232  ·  view source on GitHub ↗

\brief Append a argument list to the buffer. This function takes care of the delimiting ',' between the parameters. The lambda \c lambda is called to each argument after the comma was inserted. Usage: \code ForEachArg(parameters, [&](const auto& p) { // do something with p }); \endcode

Source from the content-addressed store, hash-verified

217 /// });
218 /// \endcode
219 inline void ForEachArg(const auto& arguments, /*XXX: invocable*/ auto&& lambda)
220 {
221 for(OnceFalse needsComma{}; const auto& arg : arguments) {
222 if constexpr(std::is_same_v<const TemplateArgument&, decltype(arg)>) {
223 if((TemplateArgument::Pack == arg.getKind()) and (0 == arg.pack_size())) {
224 break;
225 }
226 }
227
228 AppendComma(needsComma);
229
230 lambda(arg);
231 }
232 }
233
234 void InsertIfDefTemplateGuard() { AppendNewLine("#ifdef INSIGHTS_USE_TEMPLATE"sv); }
235 void InsertEndIfTemplateGuard() { AppendNewLine("#endif"sv); }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected