mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-10 20:01:25 +00:00
AGS: Add some more std replacements needed for recent AGS code
This commit is contained in:
parent
038579d0d9
commit
73ff6317fd
@ -125,6 +125,22 @@ ForwardIt upper_bound(ForwardIt first, ForwardIt last, const T &value, Compare c
|
||||
return last;
|
||||
}
|
||||
|
||||
template<class ForwardIt>
|
||||
ForwardIt next(ForwardIt it, int n = 1) {
|
||||
ForwardIt it2 = it;
|
||||
while (n > 0) { ++it2; --n; }
|
||||
while (n < 0) { --it2; ++n; }
|
||||
return it2;
|
||||
}
|
||||
|
||||
template<class BidirIt>
|
||||
BidirIt prev(BidirIt it, int n = 1) {
|
||||
BidirIt it2 = it;
|
||||
while (n > 0) { --it2; --n; }
|
||||
while (n < 0) { ++it2; ++n; }
|
||||
return it2;
|
||||
}
|
||||
|
||||
} // namespace std
|
||||
} // namespace AGS3
|
||||
|
||||
|
@ -68,6 +68,22 @@ public:
|
||||
reverse_iterator rend() {
|
||||
return reverse_iterator(Common::List<T>::end());
|
||||
}
|
||||
|
||||
void splice(typename Common::List<T>::iterator pos, list<T>& /*other*/, typename Common::List<T>::iterator it ) {
|
||||
// We insert it before pos in this list
|
||||
typename Common::List<T>::NodeBase *n = static_cast<typename Common::List<T>::NodeBase *>(it._node);
|
||||
typename Common::List<T>::NodeBase *nPos = static_cast<typename Common::List<T>::NodeBase*>(pos._node);
|
||||
if (n == nPos || n->_next == nPos)
|
||||
return;
|
||||
// Remove from current position
|
||||
n->_prev->_next = n->_next;
|
||||
n->_next->_prev = n->_prev;
|
||||
// Insert in new position
|
||||
n->_next = nPos;
|
||||
n->_prev = nPos->_prev;
|
||||
n->_prev->_next = n;
|
||||
n->_next->_prev = n;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
|
Loading…
Reference in New Issue
Block a user