Nazara Engine  0.4
A fast, complete, cross-platform API designed for game development
MovablePtr.hpp
1 // Copyright (C) 2017 Jérôme Leclercq
2 // This file is part of the "Nazara Engine - Core module"
3 // For conditions of distribution and use, see copyright notice in Config.hpp
4 
5 #pragma once
6 
7 #ifndef NAZARA_MOVABLE_PTR_HPP
8 #define NAZARA_MOVABLE_PTR_HPP
9 
10 namespace Nz
11 {
12  template<typename T>
13  class MovablePtr
14  {
15  public:
16  MovablePtr(T* value = nullptr);
17  MovablePtr(const MovablePtr&) = default;
18  MovablePtr(MovablePtr&& ptr) noexcept;
19  ~MovablePtr() = default;
20 
21  T* Get() const;
22 
23  T* operator->() const;
24 
25  operator T*() const;
26 
27  MovablePtr& operator=(T* value);
28  MovablePtr& operator=(const MovablePtr&) = default;
29  MovablePtr& operator=(MovablePtr&& ptr) noexcept;
30 
31  private:
32  T* m_value;
33  };
34 }
35 
36 #include <Nazara/Core/MovablePtr.inl>
37 
38 #endif // NAZARA_MOVABLE_PTR_HPP
TODO: Inherit SoundEmitter from Node.
Definition: Algorithm.hpp:12
Wraps a raw (non-proprietary) to allows it to be moved implicitly.
Definition: MovablePtr.hpp:13