Core: Add MovablePtr class

This commit is contained in:
Lynix
2017-09-30 13:57:25 +02:00
parent f95fc332f1
commit 2cd9fa2b7a
29 changed files with 157 additions and 259 deletions

View File

@@ -0,0 +1,38 @@
// Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Engine - Core module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_MOVABLE_PTR_HPP
#define NAZARA_MOVABLE_PTR_HPP
namespace Nz
{
template<typename T>
class MovablePtr
{
public:
MovablePtr(T* value = nullptr);
MovablePtr(const MovablePtr&) = default;
MovablePtr(MovablePtr&& ptr) noexcept;
~MovablePtr() = default;
T* Get() const;
T* operator->() const;
operator T*() const;
MovablePtr& operator=(T* value);
MovablePtr& operator=(const MovablePtr&) = default;
MovablePtr& operator=(MovablePtr&& ptr) noexcept;
private:
T* m_value;
};
}
#include <Nazara/Core/MovablePtr.inl>
#endif // NAZARA_MOVABLE_PTR_HPP