Revert "make QStack::pop() call QVector::last()"

This reverts commit 26ab0edab0.
This commit is contained in:
Ivailo Monev 2016-11-07 12:32:40 +00:00
parent 8c3c3c0aed
commit 666a24802f

View file

@ -57,9 +57,9 @@ public:
inline ~QStack() {} inline ~QStack() {}
inline void swap(QStack<T> &other) { QVector<T>::swap(other); } // prevent QVector<->QStack swaps inline void swap(QStack<T> &other) { QVector<T>::swap(other); } // prevent QVector<->QStack swaps
inline void push(const T &t) { QVector<T>::append(t); } inline void push(const T &t) { QVector<T>::append(t); }
inline T pop(); T pop();
inline T &top() { return QVector<T>::last(); }; // for compatibility T &top();
const T &top() const { return QVector<T>::last(); }; // for compatibility const T &top() const;
}; };
template<class T> template<class T>
@ -67,6 +67,14 @@ inline T QStack<T>::pop()
{ Q_ASSERT(!this->isEmpty()); T t = this->data()[this->size() -1]; { Q_ASSERT(!this->isEmpty()); T t = this->data()[this->size() -1];
this->resize(this->size()-1); return t; } this->resize(this->size()-1); return t; }
template<class T>
inline T &QStack<T>::top()
{ Q_ASSERT(!this->isEmpty()); this->detach(); return this->data()[this->size()-1]; }
template<class T>
inline const T &QStack<T>::top() const
{ Q_ASSERT(!this->isEmpty()); return this->data()[this->size()-1]; }
QT_END_NAMESPACE QT_END_NAMESPACE
QT_END_HEADER QT_END_HEADER