Library 4

This commit is contained in:
Alessandro Ferro
2021-06-09 12:03:18 +02:00
parent 4d17a3c835
commit 084a2df94e
7 changed files with 12 additions and 11 deletions

View File

@ -465,8 +465,8 @@ BTInOrderIterator<Data>::BTInOrderIterator(const BTInOrderIterator& itr){
template <typename Data>
BTInOrderIterator<Data>::BTInOrderIterator(BTInOrderIterator&& toMove) noexcept{
std::move(curr, toMove.curr);
std::move(stack, toMove.stack);
std::swap(curr, toMove.curr);
std::swap(stack, toMove.stack);
}
template <typename Data>
@ -484,8 +484,8 @@ BTInOrderIterator<Data>& BTInOrderIterator<Data>::operator=(const BTInOrderItera
template <typename Data>
BTInOrderIterator<Data>& BTInOrderIterator<Data>::operator=(BTInOrderIterator&& toMove) noexcept{
std::move(curr, toMove.curr);
std::move(stack, toMove.stack);
std::swap(curr, toMove.curr);
std::swap(stack, toMove.stack);
return *this;
}

View File

@ -134,7 +134,6 @@ BinaryTreeLnk<Data>& BinaryTreeLnk<Data>::operator=(const BinaryTreeLnk<Data>& t
template <typename Data>
BinaryTreeLnk<Data>& BinaryTreeLnk<Data>::operator=(BinaryTreeLnk<Data>&& tree) noexcept{
Clear();
std::swap(size, tree.size);
std::swap(root, tree.root);
return *this;

View File

@ -117,12 +117,14 @@ BinaryTreeVec<Data>& BinaryTreeVec<Data>::operator=(const BinaryTreeVec<Data>& b
template <typename Data>
BinaryTreeVec<Data>& BinaryTreeVec<Data>::operator=(BinaryTreeVec<Data>&& bt) noexcept{
Clear();
std::swap(size, bt.size);
std::swap(tree, bt.tree);
for(ulong i=0 ; i<size ; ++i){
tree[i]->ReferenceToTree = this;
}
for(ulong j=0 ; j<bt.Size() ; ++j){
(bt.tree[j])->ReferenceToTree = &bt;
}
return *this;
}