Add prefix inc/dec to TSLQIterWrapper
This commit is contained in:
parent
ebedd06fdb
commit
aa132fbf12
1 changed files with 17 additions and 0 deletions
|
@ -51,6 +51,9 @@ class TSLQueue {
|
||||||
bool prev();
|
bool prev();
|
||||||
std::optional<T> current();
|
std::optional<T> current();
|
||||||
|
|
||||||
|
TSLQIterWrapper<isConst, isRev>& operator++();
|
||||||
|
TSLQIterWrapper<isConst, isRev>& operator--();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::conditional_t<isConst, const std::list<T>, std::list<T>>
|
std::conditional_t<isConst, const std::list<T>, std::list<T>>
|
||||||
*containerPtr;
|
*containerPtr;
|
||||||
|
@ -333,6 +336,20 @@ std::optional<T> TSLQueue<T>::TSLQIterWrapper<isConst, isRev>::current() {
|
||||||
return *iter;
|
return *iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
template <bool isConst, bool isRev>
|
||||||
|
typename TSLQueue<T>::template TSLQIterWrapper<isConst, isRev>& TSLQueue<T>::TSLQIterWrapper<isConst, isRev>::operator++() {
|
||||||
|
next();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
template <bool isConst, bool isRev>
|
||||||
|
typename TSLQueue<T>::template TSLQIterWrapper<isConst, isRev>& TSLQueue<T>::TSLQIterWrapper<isConst, isRev>::operator--() {
|
||||||
|
prev();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
typename TSLQueue<T>::template TSLQIterWrapper<false, false> TSLQueue<T>::iter() {
|
typename TSLQueue<T>::template TSLQIterWrapper<false, false> TSLQueue<T>::iter() {
|
||||||
return TSLQIterWrapper<false, false>(&container, iterValid, iterWrapperCount);
|
return TSLQIterWrapper<false, false>(&container, iterValid, iterWrapperCount);
|
||||||
|
|
Loading…
Reference in a new issue