Skip to content

Commit

Permalink
[C++] Pass by reference rather than value when streaming to a string.
Browse files Browse the repository at this point in the history
  • Loading branch information
mjpt777 committed Feb 8, 2023
1 parent 4551cb7 commit 1973c86
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2556,7 +2556,7 @@ private void generateDisplay(
new Formatter(sb).format("\n" +
"template<typename CharT, typename Traits>\n" +
"friend std::basic_ostream<CharT, Traits> & operator << (\n" +
" std::basic_ostream<CharT, Traits> &builder, %1$s _writer)\n" +
" std::basic_ostream<CharT, Traits> &builder, %1$s &_writer)\n" +
"{\n" +
" %1$s writer(\n" +
" _writer.m_buffer,\n" +
Expand Down Expand Up @@ -2587,7 +2587,7 @@ private CharSequence generateGroupDisplay(
return String.format("\n" +
indent + "template<typename CharT, typename Traits>\n" +
indent + "friend std::basic_ostream<CharT, Traits> & operator << (\n" +
indent + " std::basic_ostream<CharT, Traits> &builder, %1$s writer)\n" +
indent + " std::basic_ostream<CharT, Traits> &builder, %1$s &writer)\n" +
indent + "{\n" +
indent + " builder << '{';\n" +
"%2$s" +
Expand All @@ -2603,7 +2603,7 @@ private CharSequence generateCompositeDisplay(final String name, final List<Toke
return String.format("\n" +
"template<typename CharT, typename Traits>\n" +
"friend std::basic_ostream<CharT, Traits> & operator << (\n" +
" std::basic_ostream<CharT, Traits> &builder, %1$s writer)\n" +
" std::basic_ostream<CharT, Traits> &builder, %1$s &writer)\n" +
"{\n" +
" builder << '{';\n" +
"%2$s" +
Expand Down Expand Up @@ -2822,7 +2822,7 @@ private CharSequence generateChoicesDisplay(final String name, final List<Token>
new Formatter(sb).format("\n" +
indent + "template<typename CharT, typename Traits>\n" +
indent + "friend std::basic_ostream<CharT, Traits> & operator << (\n" +
indent + " std::basic_ostream<CharT, Traits> &builder, %1$s writer)\n" +
indent + " std::basic_ostream<CharT, Traits> &builder, %1$s &writer)\n" +
indent + "{\n" +
indent + " builder << '[';\n",
name);
Expand Down

0 comments on commit 1973c86

Please sign in to comment.