[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
c++: don't obfuscate std::move when not needed
From: |
Akim Demaille |
Subject: |
c++: don't obfuscate std::move when not needed |
Date: |
Sat, 20 Oct 2018 10:47:12 +0200 |
commit ace93397c13910b5c25a72832efaadbdb0c428ff
Author: Akim Demaille <address@hidden>
Date: Sat Oct 20 09:09:45 2018 +0200
c++: don't obfuscate std::move when not needed
* data/lalr1.cc, data/variant.hh: Avoid macros that depend on the
version of C++ when not needed.
diff --git a/data/lalr1.cc b/data/lalr1.cc
index f80476db..7470ceda 100644
--- a/data/lalr1.cc
+++ b/data/lalr1.cc
@@ -333,7 +333,8 @@ m4_define([b4_shared_declarations],
stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) sym);
#if defined __cplusplus && __cplusplus < 201103L
/// Assignment, needed by push_back by some old implementations.
- stack_symbol_type& operator= (YY_MOVE_REF (stack_symbol_type) that);
+ /// Moves the contents of that.
+ stack_symbol_type& operator= (stack_symbol_type& that);
#endif
};
@@ -619,13 +620,13 @@ m4_if(b4_prefix, [yy], [],
#if defined __cplusplus && __cplusplus < 201103L
]b4_parser_class_name[::stack_symbol_type&
- ]b4_parser_class_name[::stack_symbol_type::operator= (YY_MOVE_REF
(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], [move], [YY_MOVE
(that.value)])],
- [[value = YY_MOVE (that.value);]])[]b4_locations_if([
- location = YY_MOVE (that.location);])[
+ [value], [move], [that.value])],
+ [[value = that.value;]])[]b4_locations_if([
+ location = that.location;])[
// that is emptied.
that.state = empty_state;
return *this;
@@ -676,7 +677,7 @@ m4_if(b4_prefix, [yy], [],
]b4_parser_class_name[::yypush_ (const char* m, state_type s, YY_MOVE_REF
(symbol_type) sym)
{
#if defined __cplusplus && 201103L <= __cplusplus
- yypush_ (m, stack_symbol_type (s, YY_MOVE (sym)));
+ yypush_ (m, stack_symbol_type (s, std::move (sym)));
#else
stack_symbol_type ss (s, sym);
yypush_ (m, ss);
diff --git a/data/variant.hh b/data/variant.hh
index 66848fd2..f76d5d7f 100644
--- a/data/variant.hh
+++ b/data/variant.hh
@@ -184,7 +184,7 @@ m4_define([b4_variant_define],
{
build<T> ();
# if defined __cplusplus && 201103L <= __cplusplus
- as<T> () = YY_MOVE (other.as<T> ());
+ as<T> () = std::move (other.as<T> ());
# else
swap<T> (other);
# endif
@@ -198,7 +198,7 @@ m4_define([b4_variant_define],
move (self_type&& other)
{
build<T> ();
- as<T> () = YY_MOVE (other.as<T> ());
+ as<T> () = std::move (other.as<T> ());
other.destroy<T> ();
}
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- c++: don't obfuscate std::move when not needed,
Akim Demaille <=