blob: c5b5b309bfc5080cede45f9a0d6d313c5fb62c6e (
plain)
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
|
#include "Private.h"
using namespace crepe;
bool Private::empty() const noexcept {
return this->instance == nullptr;
}
Private::~Private() {
if (this->instance == nullptr) return;
this->destructor(this->instance);
}
Private::Private(Private && other) {
*this = std::move(other);
}
Private & Private::operator=(Private && other) {
// TODO: ideally this function checks for self-assignment
this->instance = other.instance;
this->destructor = other.destructor;
this->type = other.type;
other.instance = nullptr;
other.destructor = [](void*){};
return *this;
}
|