Skip to content

Commit

Permalink
c++: the assignment operator does not have to be const
Browse files Browse the repository at this point in the history
* data/lalr1.cc (stack_symbol_type::operator=): Don't copy the
argument, move it.
  • Loading branch information
akimd committed Aug 30, 2018
1 parent 15233a3 commit 2116ad3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions data/lalr1.cc
Expand Up @@ -320,7 +320,7 @@ b4_location_define])])[
/// Steal the contents from \a sym to build this.
stack_symbol_type (state_type s, symbol_type& sym);
/// Assignment, needed by push_back.
stack_symbol_type& operator= (const stack_symbol_type& that);
stack_symbol_type& operator= (stack_symbol_type& that);
};

/// Stack type.
Expand Down Expand Up @@ -603,11 +603,11 @@ m4_if(b4_prefix, [yy], [],
}

]b4_parser_class_name[::stack_symbol_type&
]b4_parser_class_name[::stack_symbol_type::operator= (const stack_symbol_type& that)
]b4_parser_class_name[::stack_symbol_type::operator= (stack_symbol_type& that)
{
state = that.state;
]b4_variant_if([b4_symbol_variant([that.type_get ()],
[value], [copy], [that.value])],
[value], [move], [that.value])],
[[value = that.value;]])[]b4_locations_if([
location = that.location;])[
return *this;
Expand Down

0 comments on commit 2116ad3

Please sign in to comment.