fixing memory leak fix
This commit is contained in:
@@ -197,11 +197,15 @@ public:
|
|||||||
}
|
}
|
||||||
constexpr Map(const Map& other)
|
constexpr Map(const Map& other)
|
||||||
: alloc(other.alloc)
|
: alloc(other.alloc)
|
||||||
, root(other.root)
|
, root(nullptr)
|
||||||
, iteratorsDirty(true)
|
, iteratorsDirty(true)
|
||||||
, _size(other._size)
|
, _size(0)
|
||||||
, comp(other.comp)
|
, comp(other.comp)
|
||||||
{
|
{
|
||||||
|
for(const auto& [key, val] : other)
|
||||||
|
{
|
||||||
|
this->operator[](key) = val;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
constexpr Map(Map&& other) noexcept
|
constexpr Map(Map&& other) noexcept
|
||||||
: alloc(std::move(other.alloc))
|
: alloc(std::move(other.alloc))
|
||||||
@@ -220,9 +224,13 @@ public:
|
|||||||
if(this != &other)
|
if(this != &other)
|
||||||
{
|
{
|
||||||
alloc = other.alloc;
|
alloc = other.alloc;
|
||||||
root = other.root;
|
|
||||||
_size = other._size;
|
|
||||||
comp = other.comp;
|
comp = other.comp;
|
||||||
|
root = nullptr;
|
||||||
|
_size = 0;
|
||||||
|
for(const auto& [key, val] : other)
|
||||||
|
{
|
||||||
|
this->operator[](key) = val;
|
||||||
|
}
|
||||||
markIteratorsDirty();
|
markIteratorsDirty();
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
|
|||||||
Reference in New Issue
Block a user