X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/7d6bad195977b0204fc8406cac57cf5a4f1c769b..312c0cff71e784e116c0ecac4c33bc94d54f78de:/data/stack.hh diff --git a/data/stack.hh b/data/stack.hh index 61fbde2b..037c212f 100644 --- a/data/stack.hh +++ b/data/stack.hh @@ -41,23 +41,27 @@ m4_define([b4_stack_define], inline T& - operator [] (unsigned int i) + operator[] (unsigned int i) { return seq_[seq_.size () - 1 - i]; } inline const T& - operator [] (unsigned int i) const + operator[] (unsigned int i) const { return seq_[seq_.size () - 1 - i]; } + /// Steal the contents of \a t. + /// + /// Close to move-semantics. inline void - push (const T& t) + push (T& t) { - seq_.push_back (t); + seq_.push_back (T()); + operator[](0).move (t); } inline