-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathptr.hpp
More file actions
41 lines (28 loc) · 1.22 KB
/
Copy pathptr.hpp
File metadata and controls
41 lines (28 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* File: /lib/ptr.hpp
*
* This file is a part of cpplib project which is distributed under MIT License.
* See file LICENSE for full license details.
*
* Copyright (c) 2020-present Nikita Zuev (V.Slavski!) <[email protected]>
*/
#ifndef CPPLIB__lib__ptr__hpp
#define CPPLIB__lib__ptr__hpp
#include <memory>
#include <utility>
namespace lib {
// DECLARATION lib::Ptr, lib::PtrC
template< class T, class...Args > using Ptr = ::std::unique_ptr< T, Args... >;
template< class T, class...Args > using PtrC = ::std::unique_ptr< const T, Args... >;
// DECLARATION lib::SPtr, lib::SPtrC
template< class T > using SPtr = ::std::shared_ptr< T >;
template< class T > using SPtrC = ::std::shared_ptr< const T >;
// DECLARATION lib::WPtr, lib::WPtrC
template< class T > using WPtr = ::std::weak_ptr< T >;
template< class T > using WPtrC = ::std::weak_ptr< const T >;
// DECLARATION lib::MkPtr, lib::MkSPtr
template< class T, class...Args > inline auto MkPtr( Args&&...args )
{ return ::std::make_unique<T>( ::std::forward<Args>(args)... ); }
template< class T, class...Args > inline auto MkSPtr( Args&&...args )
{ return ::std::make_shared<T>( ::std::forward<Args>(args)... ); }
} // namespace lib
#endif // CPPLIB__lib__ptr__hpp