mirror of https://github.com/xfarrow/lasd.git
Library 3
This commit is contained in:
parent
2161904478
commit
4d17a3c835
|
@ -465,8 +465,8 @@ BTInOrderIterator<Data>::BTInOrderIterator(const BTInOrderIterator& itr){
|
||||||
|
|
||||||
template <typename Data>
|
template <typename Data>
|
||||||
BTInOrderIterator<Data>::BTInOrderIterator(BTInOrderIterator&& toMove) noexcept{
|
BTInOrderIterator<Data>::BTInOrderIterator(BTInOrderIterator&& toMove) noexcept{
|
||||||
std::move(curr, toMove.curr);
|
std::swap(curr, toMove.curr);
|
||||||
std::move(stack, toMove.stack);
|
std::swap(stack, toMove.stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Data>
|
template <typename Data>
|
||||||
|
@ -484,8 +484,8 @@ BTInOrderIterator<Data>& BTInOrderIterator<Data>::operator=(const BTInOrderItera
|
||||||
|
|
||||||
template <typename Data>
|
template <typename Data>
|
||||||
BTInOrderIterator<Data>& BTInOrderIterator<Data>::operator=(BTInOrderIterator&& toMove) noexcept{
|
BTInOrderIterator<Data>& BTInOrderIterator<Data>::operator=(BTInOrderIterator&& toMove) noexcept{
|
||||||
std::move(curr, toMove.curr);
|
std::swap(curr, toMove.curr);
|
||||||
std::move(stack, toMove.stack);
|
std::swap(stack, toMove.stack);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,6 @@ BinaryTreeLnk<Data>& BinaryTreeLnk<Data>::operator=(const BinaryTreeLnk<Data>& t
|
||||||
|
|
||||||
template <typename Data>
|
template <typename Data>
|
||||||
BinaryTreeLnk<Data>& BinaryTreeLnk<Data>::operator=(BinaryTreeLnk<Data>&& tree) noexcept{
|
BinaryTreeLnk<Data>& BinaryTreeLnk<Data>::operator=(BinaryTreeLnk<Data>&& tree) noexcept{
|
||||||
Clear();
|
|
||||||
std::swap(size, tree.size);
|
std::swap(size, tree.size);
|
||||||
std::swap(root, tree.root);
|
std::swap(root, tree.root);
|
||||||
return *this;
|
return *this;
|
||||||
|
|
|
@ -117,12 +117,14 @@ BinaryTreeVec<Data>& BinaryTreeVec<Data>::operator=(const BinaryTreeVec<Data>& b
|
||||||
|
|
||||||
template <typename Data>
|
template <typename Data>
|
||||||
BinaryTreeVec<Data>& BinaryTreeVec<Data>::operator=(BinaryTreeVec<Data>&& bt) noexcept{
|
BinaryTreeVec<Data>& BinaryTreeVec<Data>::operator=(BinaryTreeVec<Data>&& bt) noexcept{
|
||||||
Clear();
|
|
||||||
std::swap(size, bt.size);
|
std::swap(size, bt.size);
|
||||||
std::swap(tree, bt.tree);
|
std::swap(tree, bt.tree);
|
||||||
for(ulong i=0 ; i<size ; ++i){
|
for(ulong i=0 ; i<size ; ++i){
|
||||||
tree[i]->ReferenceToTree = this;
|
tree[i]->ReferenceToTree = this;
|
||||||
}
|
}
|
||||||
|
for(ulong j=0 ; j<bt.Size() ; ++j){
|
||||||
|
(bt.tree[j])->ReferenceToTree = &bt;
|
||||||
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -167,7 +167,7 @@ void List<Data>::InsertAtBack(const Data& data){
|
||||||
template <typename Data>
|
template <typename Data>
|
||||||
void List<Data>::InsertAtBack(Data&& data){
|
void List<Data>::InsertAtBack(Data&& data){
|
||||||
if(size == 0){
|
if(size == 0){
|
||||||
InsertAtFront(data);
|
InsertAtFront(std::move(data));
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
struct Node* last = new Node(std::move(data));
|
struct Node* last = new Node(std::move(data));
|
||||||
|
|
|
@ -37,7 +37,7 @@ QueueVec<Data>::QueueVec(const QueueVec& toCopy){
|
||||||
|
|
||||||
template <typename Data>
|
template <typename Data>
|
||||||
QueueVec<Data>::QueueVec(QueueVec&& toMove) noexcept{
|
QueueVec<Data>::QueueVec(QueueVec&& toMove) noexcept{
|
||||||
Clear();
|
Clear(); // the moved Queue will be in a consistent state
|
||||||
std::swap(Elements, toMove.Elements);
|
std::swap(Elements, toMove.Elements);
|
||||||
std::swap(rear, toMove.rear);
|
std::swap(rear, toMove.rear);
|
||||||
std::swap(front, toMove.front);
|
std::swap(front, toMove.front);
|
||||||
|
|
|
@ -52,7 +52,7 @@ void StackLst<Data>::Push(const Data& element){
|
||||||
|
|
||||||
template <typename Data>
|
template <typename Data>
|
||||||
void StackLst<Data>::Push(Data&& element) noexcept{
|
void StackLst<Data>::Push(Data&& element) noexcept{
|
||||||
List<Data>::InsertAtFront(element);
|
List<Data>::InsertAtFront(std::move(element));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Data>
|
template <typename Data>
|
||||||
|
|
|
@ -44,7 +44,7 @@ StackVec<Data>& StackVec<Data>::operator=(const StackVec<Data>& copyFrom){
|
||||||
template <typename Data>
|
template <typename Data>
|
||||||
StackVec<Data>& StackVec<Data>::operator=(StackVec<Data>&& moveFrom) noexcept{
|
StackVec<Data>& StackVec<Data>::operator=(StackVec<Data>&& moveFrom) noexcept{
|
||||||
Vector<Data>::operator=(std::move(moveFrom));
|
Vector<Data>::operator=(std::move(moveFrom));
|
||||||
stackSize = moveFrom.Size();
|
std::swap(stackSize, moveFrom.stackSize);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue