mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-23 18:32:55 +00:00
make QStack::pop() call QVector::last()
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
parent
d182b91452
commit
26ab0edab0
1 changed files with 3 additions and 11 deletions
|
@ -57,9 +57,9 @@ public:
|
|||
inline ~QStack() {}
|
||||
inline void swap(QStack<T> &other) { QVector<T>::swap(other); } // prevent QVector<->QStack swaps
|
||||
inline void push(const T &t) { QVector<T>::append(t); }
|
||||
T pop();
|
||||
T &top();
|
||||
const T &top() const;
|
||||
inline T pop();
|
||||
inline T &top() { return QVector<T>::last(); }; // for compatibility
|
||||
const T &top() const { return QVector<T>::last(); }; // for compatibility
|
||||
};
|
||||
|
||||
template<class T>
|
||||
|
@ -67,14 +67,6 @@ inline T QStack<T>::pop()
|
|||
{ Q_ASSERT(!this->isEmpty()); T t = this->data()[this->size() -1];
|
||||
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_HEADER
|
||||
|
|
Loading…
Add table
Reference in a new issue