-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathdutility.h
47 lines (42 loc) · 1.07 KB
/
dutility.h
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
42
43
44
45
46
47
#pragma once
#include <memory>
#include "dptr.h"
namespace dumpable
{
template <typename T>
struct not_dump : public T
{
not_dump<T>& operator = (T&& x)
{
if (detail::dumpable_is_custom_alloc())
T::operator=(T());
else
T::operator=(std::move(x));
return *this;
}
not_dump<T>& operator = (const T& x)
{
if (detail::dumpable_is_custom_alloc())
T::operator=(T());
else
T::operator=(x);
return *this;
}
not_dump<T>& operator = (not_dump<T>&& x)
{
if (detail::dumpable_is_custom_alloc())
T::operator=(T());
else
T::operator=(std::move(x));
return *this;
}
not_dump<T>& operator = (const not_dump<T>& x)
{
if (detail::dumpable_is_custom_alloc())
T::operator=(T());
else
T::operator=(x);
return *this;
}
};
}