Skip to content

Commit 1973c86

Browse files
committed
[C++] Pass by reference rather than value when streaming to a string.
1 parent 4551cb7 commit 1973c86

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/cpp/CppGenerator.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2556,7 +2556,7 @@ private void generateDisplay(
25562556
new Formatter(sb).format("\n" +
25572557
"template<typename CharT, typename Traits>\n" +
25582558
"friend std::basic_ostream<CharT, Traits> & operator << (\n" +
2559-
" std::basic_ostream<CharT, Traits> &builder, %1$s _writer)\n" +
2559+
" std::basic_ostream<CharT, Traits> &builder, %1$s &_writer)\n" +
25602560
"{\n" +
25612561
" %1$s writer(\n" +
25622562
" _writer.m_buffer,\n" +
@@ -2587,7 +2587,7 @@ private CharSequence generateGroupDisplay(
25872587
return String.format("\n" +
25882588
indent + "template<typename CharT, typename Traits>\n" +
25892589
indent + "friend std::basic_ostream<CharT, Traits> & operator << (\n" +
2590-
indent + " std::basic_ostream<CharT, Traits> &builder, %1$s writer)\n" +
2590+
indent + " std::basic_ostream<CharT, Traits> &builder, %1$s &writer)\n" +
25912591
indent + "{\n" +
25922592
indent + " builder << '{';\n" +
25932593
"%2$s" +
@@ -2603,7 +2603,7 @@ private CharSequence generateCompositeDisplay(final String name, final List<Toke
26032603
return String.format("\n" +
26042604
"template<typename CharT, typename Traits>\n" +
26052605
"friend std::basic_ostream<CharT, Traits> & operator << (\n" +
2606-
" std::basic_ostream<CharT, Traits> &builder, %1$s writer)\n" +
2606+
" std::basic_ostream<CharT, Traits> &builder, %1$s &writer)\n" +
26072607
"{\n" +
26082608
" builder << '{';\n" +
26092609
"%2$s" +
@@ -2822,7 +2822,7 @@ private CharSequence generateChoicesDisplay(final String name, final List<Token>
28222822
new Formatter(sb).format("\n" +
28232823
indent + "template<typename CharT, typename Traits>\n" +
28242824
indent + "friend std::basic_ostream<CharT, Traits> & operator << (\n" +
2825-
indent + " std::basic_ostream<CharT, Traits> &builder, %1$s writer)\n" +
2825+
indent + " std::basic_ostream<CharT, Traits> &builder, %1$s &writer)\n" +
28262826
indent + "{\n" +
28272827
indent + " builder << '[';\n",
28282828
name);

0 commit comments

Comments
 (0)