diff --git a/src/core/tools/qstack.h b/src/core/tools/qstack.h index 0bcce80d0..a924b1b4c 100644 --- a/src/core/tools/qstack.h +++ b/src/core/tools/qstack.h @@ -57,9 +57,9 @@ public: inline ~QStack() {} inline void swap(QStack &other) { QVector::swap(other); } // prevent QVector<->QStack swaps inline void push(const T &t) { QVector::append(t); } - T pop(); - T &top(); - const T &top() const; + inline T pop(); + inline T &top() { return QVector::last(); }; // for compatibility + const T &top() const { return QVector::last(); }; // for compatibility }; template @@ -67,14 +67,6 @@ inline T QStack::pop() { Q_ASSERT(!this->isEmpty()); T t = this->data()[this->size() -1]; this->resize(this->size()-1); return t; } -template -inline T &QStack::top() -{ Q_ASSERT(!this->isEmpty()); this->detach(); return this->data()[this->size()-1]; } - -template -inline const T &QStack::top() const -{ Q_ASSERT(!this->isEmpty()); return this->data()[this->size()-1]; } - QT_END_NAMESPACE QT_END_HEADER