Skip to content

Commit d2ec8f8

Browse files
authored
CppGenerator: operator<< take messages as const-ref (#939)
Following commit 1973c86, using generated operator<< would require a mutable ref message. This is unnecessary and can be problematic. Ex: using wrappers such as fmt::streamed ( https://fmt.dev/latest/api.html#std-ostream-support )
1 parent 461204a commit d2ec8f8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2564,7 +2564,7 @@ private void generateDisplay(
25642564
new Formatter(sb).format("\n" +
25652565
"template<typename CharT, typename Traits>\n" +
25662566
"friend std::basic_ostream<CharT, Traits> & operator << (\n" +
2567-
" std::basic_ostream<CharT, Traits> &builder, %1$s &_writer)\n" +
2567+
" std::basic_ostream<CharT, Traits> &builder, const %1$s &_writer)\n" +
25682568
"{\n" +
25692569
" %1$s writer(\n" +
25702570
" _writer.m_buffer,\n" +

0 commit comments

Comments
 (0)