-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.cpp
More file actions
44 lines (34 loc) · 736 Bytes
/
test.cpp
File metadata and controls
44 lines (34 loc) · 736 Bytes
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
#include "signed_ptr.h"
#include <iostream>
#include <Windows.h>
//test class with a few attributes
class sample
{
public:
int ivalue;
std::string svalue;
//test constructor with a param
sample(int x) {
ivalue = x;
svalue = "test";
}
};
int main() {
//nullptr assignment
signed_ptr<decltype(MessageBoxA)> ptr = nullptr;
//no value
signed_ptr<decltype(MessageBoxA)> other;
//value assignment
ptr = MessageBoxA;
//assign another signed ptr
other = ptr;
//deref ptr
(*other)(0, "Hey", "", 0);
//constructor with params
signed_ptr<sample> s = make_signed<sample>(1337);
//getting underlying values
std::cout << s->ivalue << std::endl;
std::cout << (*s).svalue << std::endl;
//deallocation
s.destroy();
}