From 2116ad3a280f79ab28eba244a00d7d1358f141ef Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sat, 25 Aug 2018 11:41:08 +0200 Subject: [PATCH] c++: the assignment operator does not have to be const * data/lalr1.cc (stack_symbol_type::operator=): Don't copy the argument, move it. --- data/lalr1.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/data/lalr1.cc b/data/lalr1.cc index 143f3d4b..ab48d506 100644 --- a/data/lalr1.cc +++ b/data/lalr1.cc @@ -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. @@ -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;