|
|
@@ -33,6 +33,25 @@ LinkedListNode(bool) {
|
|
|
_prev = this;
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * This move constructor replaces the other link with this one.
|
|
|
+ */
|
|
|
+INLINE LinkedListNode::
|
|
|
+LinkedListNode(LinkedListNode &&from) noexcept {
|
|
|
+ if (from._prev != nullptr) {
|
|
|
+ nassertv(from._prev->_next == &from);
|
|
|
+ from._prev->_next = this;
|
|
|
+ }
|
|
|
+ _prev = from._prev;
|
|
|
+ if (from._next != nullptr) {
|
|
|
+ nassertv(from._next->_prev == &from);
|
|
|
+ from._next->_prev = this;
|
|
|
+ }
|
|
|
+ _next = from._next;
|
|
|
+ from._next = nullptr;
|
|
|
+ from._prev = nullptr;
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
*
|
|
|
*/
|
|
|
@@ -41,6 +60,23 @@ INLINE LinkedListNode::
|
|
|
nassertv((_next == nullptr && _prev == nullptr) || (_next == this && _prev == this));
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * Replaces the given other node with this node.
|
|
|
+ */
|
|
|
+INLINE LinkedListNode &LinkedListNode::
|
|
|
+operator = (LinkedListNode &&from) {
|
|
|
+ nassertr((_next == nullptr && _prev == nullptr) || (_next == this && _prev == this), *this);
|
|
|
+ nassertr(from._prev != nullptr && from._next != nullptr, *this);
|
|
|
+ nassertr(from._prev->_next == &from && from._next->_prev == &from, *this);
|
|
|
+ from._prev->_next = this;
|
|
|
+ from._next->_prev = this;
|
|
|
+ _prev = from._prev;
|
|
|
+ _next = from._next;
|
|
|
+ from._next = nullptr;
|
|
|
+ from._prev = nullptr;
|
|
|
+ return *this;
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* Returns true if the node is member of any list, false if it has been
|
|
|
* removed or never added. The head of a list generally appears to to always
|