瀏覽代碼

Improved GC and added a GC pass to the shell

master
Ludovic 'Archivist' Lagouardette 6 年之前
父節點
當前提交
776ee87caa
共有 3 個文件被更改,包括 22 次插入0 次删除
  1. +1
    -0
      .gitignore
  2. +20
    -0
      crank.h
  3. +1
    -0
      main.cpp

+ 1
- 0
.gitignore 查看文件

@ -0,0 +1 @@
a.out

+ 20
- 0
crank.h 查看文件

@ -289,6 +289,26 @@ public:
void collect()
{
auto elems = &elements;
while(elems->ptr)
{
auto elems_after = &(elems->ptr->next);
while(elems_after->ptr)
{
if(
elems->ptr->data.first == elems_after->ptr->data.first
)
{
*elems_after = std::move(elems_after->ptr->next);
}
else
{
elems_after = &(elems_after->ptr->next);
}
}
elems = &(elems->ptr->next);
}
auto cps = &copies;
while(cps->ptr)
{

+ 1
- 0
main.cpp 查看文件

@ -30,6 +30,7 @@ int main()
for(auto c : ret)
std::cout<<c;
std::cout<<std::endl<<"> ";
ctx.collect();
}
}

Loading…
取消
儲存