Made exposed endpoints static

This commit is contained in:
Victor Olin 2023-02-24 12:01:37 +01:00
parent bbd2650445
commit a684fe1ea0
6 changed files with 121 additions and 62 deletions

33
src/GC/tests/advance.cpp Normal file
View file

@ -0,0 +1,33 @@
#include <iostream>
#include <list>
#include <stdlib.h>
using namespace std;
int main() {
list<char> l;
char c = 'a';
for (int i = 1; i <= 5; i++) {
l.push_back(c++);
}
auto iter = l.begin();
auto stop = l.end();
while (iter != stop) {
cout << *iter << " ";
iter++;
}
cout << endl;
iter = l.begin();
while (*iter != *stop) {
cout << *iter << " ";
iter++;
}
cout << endl;
// cout << "iter: " << *iter << "\nstop: " << *stop << endl;
return 0;
}

View file

@ -17,7 +17,7 @@ Node *create_chain(int depth) {
for (int i = 0; i < depth; i++) {
Node *node = static_cast<Node *>(gc->alloc(sizeof(Node)));
node->id = depth-i;
node->child = nodes[i-1];
node->child = nodes[i];
nodes.push_back(node);
}
for (size_t i = 0; i < nodes.size(); i++) {
@ -83,8 +83,8 @@ int main() {
longs[i] = static_cast<long *>(gc->alloc(sizeof(long)));
} */
Node *root = static_cast<Node *>(gc->alloc(sizeof(Node)));
root = test_chain(3, false);
//Node *root = static_cast<Node *>(gc->alloc(sizeof(Node)));
Node *root = test_chain(100, true);
std::cout << "Adress of root:\t" << &root << std::endl;
std::cout << "Root points to:\t" << root << std::endl;
std::cout << "Root child:\t" << root->child << std::endl;