19#ifndef LIB_QUENTIER_UTILITY_LIMITED_STACK_H
20#define LIB_QUENTIER_UTILITY_LIMITED_STACK_H
37 m_limit(-1), m_deleter(deleter)
41 QStack<T>(other), m_limit(other.m_limit), m_deleter(other.m_deleter)
45 QStack<T>(std::move(other)), m_limit(std::move(other.m_limit)),
46 m_deleter(std::move(other.m_deleter))
52 QStack<T>::operator=(other);
53 m_limit = other.m_limit;
54 m_deleter = other.m_deleter;
63 QStack<T>::operator=(std::move(other));
64 m_limit = std::move(other.m_limit);
65 m_deleter = std::move(other.m_deleter);
74 while (!QStack<T>::isEmpty()) {
75 T t = QStack<T>::pop();
83 int limit = other.m_limit;
84 other.m_limit = m_limit;
87 void (*deleter)(T &) = other.m_deleter;
88 other.m_deleter = m_deleter;
91 QStack<T>::swap(other);
98 void setLimit(
const int limit)
103 void push(
const T & t)
105 if ((m_limit > 0) && (QVector<T>::size() == m_limit - 1)) {
107 (*m_deleter)(*QVector<T>::begin());
109 Q_UNUSED(QVector<T>::erase(QVector<T>::begin()));
117 void (*m_deleter)(T &);
The LimitedStack template class implements a stack which may have a limitation for its size; when the...
Definition LimitedStack.h:34