hx3d  1
2D/3D Simple Game Framework
ptr.hpp
1 /*
2  Smart pointers management.
3  It's a simple suite of usings for fast writing.
4 
5  Copyright (C) 2015 Denis BOURGE
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Lesser General Public
9  License as published by the Free Software Foundation; either
10  version 2.1 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public
18  License along with this library; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
20  USA
21 */
22 
23 #ifndef HX3D_UTILS_PTR
24 #define HX3D_UTILS_PTR
25 
26 #include <memory>
27 
28 namespace hx3d {
29 
33 template <class T>
34 using Ptr = std::shared_ptr<T>;
35 
39 template <class T>
40 using UPtr = std::unique_ptr<T>;
41 
45 template <class T>
46 using EnableSharedThis = std::enable_shared_from_this<T>;
47 
51 template <class T, class... Args>
52 Ptr<T> Make(Args&&... args) {
53  return std::make_shared<T>(args...);
54 }
55 
56 } /* hx3d */
57 
58 #endif
hx3d framework namespace
Definition: audio.hpp:26
std::enable_shared_from_this< T > EnableSharedThis
Quick-typing enable shared from this.
Definition: ptr.hpp:46
std::unique_ptr< T > UPtr
Quick-typing unique ptr.
Definition: ptr.hpp:40
Ptr< T > Make(Args &&...args)
Quick-typing make shared.
Definition: ptr.hpp:52
std::shared_ptr< T > Ptr
Quick-typing shared ptr.
Definition: ptr.hpp:34