adding ansi color codes
This commit is contained in:
51
includes/unstd/weak_ptr.hpp
Normal file
51
includes/unstd/weak_ptr.hpp
Normal file
@@ -0,0 +1,51 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* weak_ptr.hpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/01/20 11:17:07 by maldavid #+# #+# */
|
||||
/* Updated: 2024/01/20 19:13:13 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef __UNSTD_WEAK_PTR__
|
||||
#define __UNSTD_WEAK_PTR__
|
||||
|
||||
#include <unstd/bits/ref_counter.hpp>
|
||||
#include <unstd/shared_ptr.hpp>
|
||||
|
||||
namespace unstd
|
||||
{
|
||||
template <typename T>
|
||||
class WeakPtr
|
||||
{
|
||||
public:
|
||||
WeakPtr();
|
||||
WeakPtr(const WeakPtr& rhs);
|
||||
WeakPtr(const SharedPtr<T>& shared);
|
||||
|
||||
WeakPtr& operator=(const WeakPtr& rhs);
|
||||
WeakPtr& operator=(const SharedPtr<T>& shared);
|
||||
|
||||
void reset();
|
||||
void swap(WeakPtr& rhs);
|
||||
bool expired() const;
|
||||
|
||||
SharedPtr<T> lock() const;
|
||||
|
||||
~WeakPtr();
|
||||
|
||||
private:
|
||||
void safeRelease();
|
||||
|
||||
private:
|
||||
bits::RefCount* _ref;
|
||||
T* _ptr;
|
||||
};
|
||||
}
|
||||
|
||||
#include <unstd/weak_ptr.ipp>
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user