Skip to content

Commit

Permalink
CppGenerator: operator<< take messages as const-ref (#939)
Browse files Browse the repository at this point in the history
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 )
  • Loading branch information
SBAM committed May 19, 2023
1 parent 461204a commit d2ec8f8
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2564,7 +2564,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, const %1$s &_writer)\n" +
"{\n" +
" %1$s writer(\n" +
" _writer.m_buffer,\n" +
Expand Down

0 comments on commit d2ec8f8

Please sign in to comment.