BRAAAAAAAAAAAAAAAPAPAPAPAPAAAAPPAAPAPAPA

This commit is contained in:
Kbz-8
2024-01-21 12:31:52 +01:00
parent 6377c9e096
commit 9ae6ad183b
4 changed files with 21 additions and 27 deletions

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/20 10:09:02 by maldavid #+# #+# */
/* Updated: 2024/01/20 19:12:42 by maldavid ### ########.fr */
/* Updated: 2024/01/21 12:27:07 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
@@ -43,7 +43,6 @@ namespace unstd
void safeRelease();
private:
static std::map<void*, bits::RefCount*> _refs;
T* _ptr;
bits::RefCount* _ref;
};

View File

@@ -15,17 +15,7 @@ namespace unstd
template <typename T>
SharedPtr<T>::SharedPtr(T* ptr) : _ptr(ptr)
{
typename std::map<void*, bits::RefCount*>::iterator it = _refs.find(static_cast<void*>(ptr));
if(it == _refs.end())
{
_ref = new bits::RefCount(1, 0);
_refs[static_cast<void*>(ptr)] = _ref;
}
else
{
_ref = it->second;
_ref->shared++;
}
_ref = new bits::RefCount(1, 0);
}
template <typename T>
@@ -100,17 +90,7 @@ namespace unstd
{
safeRelease();
_ptr = ptr;
typename std::map<void*, bits::RefCount*>::iterator it = _refs.find(static_cast<void*>(ptr));
if(it == _refs.end())
{
_ref = new bits::RefCount(1, 0);
_refs[static_cast<void*>(ptr)] = _ref;
}
else
{
_ref = it->second;
_ref->shared++;
}
_ref = new bits::RefCount(1, 0);
}
template <typename T>