-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
115 lines (104 loc) · 2.22 KB
/
main.cpp
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#ifdef _WIN32
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#endif
#include <iostream>
#include <string>
#include "rcgc_ptr.h"
#include "rcgc_d_ptr.h"
#include "rcgc_f_ptr.h"
#include "rcgc_n_ptr.h"
#include "rcgc_c_ptr.h"
class CNode
{
public:
size_t i;
public:
CNode()
: i(0)
, links(this)
, name(this)
{}
public:
rcgc_w_str name;
rcgc_ptr_vector<CNode> links;
};
class DNode
{
public:
size_t i;
public:
DNode()
: i(0)
, links(this)
, name(this)
{}
void disposing() {
this->links.disposing();
}
public:
rcgc_w_str name;
rcgc_d_ptr_vector<DNode> links;
};
class FNode
{
public:
size_t i;
public:
FNode()
: i(0)
, links(this)
, name(this)
{}
void disposing() {
this->links.disposing();
}
void finalize() {
//this is the detor
}
public:
rcgc_w_str name;
rcgc_f_ptr_vector<FNode> links;
};
int main() {
#ifdef _WIN32
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif
//srand((unsigned int)time(nullptr));
rcgc_base::SetAutoCollect(true);
const size_t MaxNodes = 4;
rcgc_d_ptr_vector<DNode> dnodes;
rcgc_f_ptr_vector<FNode> fnodes;
rcgc_ptr_vector<CNode> cnodes;
for (size_t i = 0; i < MaxNodes; i++) {
CNode* c = new CNode();
c->i = i;
(*cnodes).push_back(c);
DNode* d = new DNode();
d->i = i;
(*dnodes).push_back(d);
FNode* f = new FNode();
f->i = i;
(*fnodes).push_back(f);
}
//full connection
for (size_t i = 0; i < (*cnodes).size(); i++) {
for (size_t j = 0; j < (*cnodes).size(); j++) {
(*cnodes)[i]->links->push_back((*cnodes)[j]);
}
}
for (size_t i = 0; i < (*dnodes).size(); i++) {
for (size_t j = 0; j < (*dnodes).size(); j++) {
(*dnodes)[i]->links->push_back((*dnodes)[j]);
}
}
for (size_t i = 0; i < (*fnodes).size(); i++) {
for (size_t j = 0; j < (*fnodes).size(); j++) {
(*fnodes)[i]->links->push_back((*fnodes)[j]);
}
}
rcgc_w_str mystr(L"Hello World");
rcgc_w_str mystr2 = L"Hello 2";
return 0;
}