source:
examples/gc_no_raii/src/gc.h
@
e054263f
Last change on this file since e054263f was bf71cfd, checked in by , 6 years ago | |
---|---|
|
|
File size: 408 bytes |
Rev | Line | |
---|---|---|
[15db1ab] | 1 | #pragma once |
2 | ||
3 | #include "gcpointers.h" | |
[f1e42c1] | 4 | #include "internal/collector.h" |
[15db1ab] | 5 | |
[6643e72] | 6 | // forall(otype T) |
7 | // static inline gcpointer(T) gcmalloc() | |
8 | // { | |
9 | // gcpointer(T) ptr = { gc_allocate(sizeof(T)) }; | |
10 | // ptr{}; | |
11 | // gc_conditional_collect(); | |
12 | // return ptr; | |
13 | // } | |
[e297ceb] | 14 | |
15 | forall(otype T) | |
16 | static inline void gcmalloc(gcpointer(T)* ptr) | |
17 | { | |
[6643e72] | 18 | ptr { gc_allocate(sizeof(T)) }; |
19 | get(ptr) {}; | |
[e297ceb] | 20 | gc_conditional_collect(); |
21 | } |
Note: See TracBrowser
for help on using the repository browser.