Sleeping Wombat Common Library
0.50.0
swCommonLibrary
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
Common
UPtr.h
1
#pragma once
2
9
template
<
typename
WrappedType >
10
class
UPtr
11
{
12
private
:
13
WrappedType* m_ptr;
14
15
public
:
16
UPtr
()
17
: m_ptr(
nullptr
)
18
{}
19
20
UPtr
( WrappedType* ptr )
21
: m_ptr( ptr )
22
{}
23
24
~
UPtr
()
25
{ ReleaseResource(); }
26
27
UPtr
(
const
UPtr< WrappedType >
& other ) =
delete
;
28
UPtr
(
UPtr< WrappedType >
&& other )
29
{
30
if
(
this
!= &other)
31
{
32
m_resource = other.m_resource;
33
other.m_resource =
nullptr
;
34
}
35
}
36
37
38
void
operator=(
const
UPtr< WrappedType >
& other ) =
delete
;
39
40
void
operator=(
UPtr< WrappedType >
&& other )
41
{
42
ReleaseResource();
43
44
m_ptr = other.m_ptr;
45
other.m_ptr =
nullptr
;
46
}
47
48
49
50
51
void
ReleaseResource()
52
{
53
if
( m_ptr )
54
delete
m_ptr;
55
m_ptr =
nullptr
;
56
}
57
58
void
AssignPointer( WrappedType* ptr )
59
{
60
m_ptr = ptr;
61
}
62
};
UPtr
Definition:
UPtr.h:10
Generated on Thu May 31 2018 19:55:59 for Sleeping Wombat Common Library by
1.8.9.1