Using epicsAlgorithm.h
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
#define __EPICS_LIST_H__
|
||||
|
||||
#include "epicsListBase.h"
|
||||
#include "epicsExcept.h"
|
||||
#include <stdexcept>
|
||||
|
||||
// epicsList
|
||||
@@ -59,7 +58,7 @@ public:
|
||||
|
||||
iterator insert(iterator position, const T x);
|
||||
iterator erase(iterator position);
|
||||
iterator erase(iterator position, iterator last);
|
||||
iterator erase(iterator position, iterator leave);
|
||||
void swap(epicsList<T>& x);
|
||||
void clear();
|
||||
|
||||
@@ -85,8 +84,13 @@ friend class epicsListConstIterator<T>;
|
||||
template <class T>
|
||||
inline void swap(epicsList<T>& x, epicsList<T>& y) { x.swap(y); }
|
||||
|
||||
template <class T>
|
||||
inline void epicsSwap(epicsList<T>& x, epicsList<T>& y) { x.swap(y); }
|
||||
|
||||
|
||||
// Mutable iterator
|
||||
// These used to be inner classes of epicsList<T>, but MSVC6
|
||||
// didn't like that so they had to be typedefs...
|
||||
|
||||
template <class T>
|
||||
class epicsListIterator {
|
||||
@@ -281,8 +285,8 @@ inline epicsList<T>::iterator epicsList<T>::erase(iterator pos) {
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline epicsList<T>::iterator epicsList<T>::erase(iterator pos, iterator last) {
|
||||
while (pos != last) {
|
||||
inline epicsList<T>::iterator epicsList<T>::erase(iterator pos, iterator leave) {
|
||||
while (pos != leave) {
|
||||
pos = erase(pos);
|
||||
}
|
||||
return pos;
|
||||
@@ -292,9 +296,7 @@ template <class T>
|
||||
inline void epicsList<T>::swap(epicsList<T>& x) {
|
||||
_head.swap(x._head);
|
||||
_pool.swap(x._pool);
|
||||
size_type temp = x._count;
|
||||
x._count = _count;
|
||||
_count = temp;
|
||||
epicsSwap(x._count, _count);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#endif
|
||||
|
||||
#include "epicsMutex.h"
|
||||
#include "epicsAlgorithm.h"
|
||||
|
||||
// epicsListNode
|
||||
class epicsListNode {
|
||||
@@ -127,9 +128,7 @@ inline epicsListLink* epicsListLink::extract() {
|
||||
}
|
||||
|
||||
inline void epicsListLink::swap(epicsListLink& node) {
|
||||
epicsListLink* tn = node._next;
|
||||
node._next = _next;
|
||||
_next = tn;
|
||||
epicsSwap(node._next, _next);
|
||||
}
|
||||
|
||||
|
||||
@@ -185,14 +184,11 @@ inline void epicsListNode::unlink() {
|
||||
}
|
||||
|
||||
inline void epicsListNode::swap(epicsListNode& node) {
|
||||
epicsListNode* temp = node._next;
|
||||
node._next = _next;
|
||||
_next = temp;
|
||||
epicsSwap(node._next, _next);
|
||||
_next->_prev = this;
|
||||
node._next->_prev = &node;
|
||||
temp = node._prev;
|
||||
node._prev = _prev;
|
||||
_prev = temp;
|
||||
|
||||
epicsSwap(node._prev, _prev);
|
||||
_prev->_next = this;
|
||||
node._prev->_next = &node;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user