Skip to content

Commit

Permalink
[C++] Revert use of auto in lambdas. Issue #903.
Browse files Browse the repository at this point in the history
  • Loading branch information
mjpt777 committed Jun 26, 2022
1 parent 57dd44d commit d5966bf
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2642,19 +2642,20 @@ private CharSequence appendDisplay(
new Formatter(sb).format(
indent + "{\n" +
indent + " bool atLeastOne = false;\n" +
indent + " builder << R\"(\"%2$s\": [)\";\n" +
indent + " writer.%1$s().forEach(\n" +
indent + " [&](auto &&%1$s)\n" +
indent + " builder << R\"(\"%3$s\": [)\";\n" +
indent + " writer.%2$s().forEach(\n" +
indent + " [&](%1$s &%2$s)\n" +
indent + " {\n" +
indent + " if (atLeastOne)\n" +
indent + " {\n" +
indent + " builder << \", \";\n" +
indent + " }\n" +
indent + " atLeastOne = true;\n" +
indent + " builder << %1$s;\n" +
indent + " builder << %2$s;\n" +
indent + " });\n" +
indent + " builder << ']';\n" +
indent + "}\n\n",
formatClassName(groupToken.name()),
formatPropertyName(groupToken.name()),
groupToken.name());

Expand Down Expand Up @@ -3108,7 +3109,8 @@ private CharSequence generateMessageLength(final List<Token> groups, final List<
}

new Formatter(sbSkip).format(
indent + " %1$s().forEach([](auto &&e){ e.skip(); });\n",
indent + " %2$s().forEach([](%1$s &e){ e.skip(); });\n",
formatClassName(groupToken.name()),
formatPropertyName(groupToken.name()));

i = endSignal;
Expand Down

0 comments on commit d5966bf

Please sign in to comment.