
O/H Larry Evans έγραψε:
On 09/17/07 09:55, Achilleas Margaritis wrote:
Larry Evans wrote: [snip]
However, I'm still wondering if it cppgc can handle gc_ptr<std::vector<T> > or pointer to any other std container. Do you have tests for these cases? It's very easy to make an STL allocator for gc: the allocator's pointer type will be gc_ptr<T>.
The following will be possible:
gc_ptr<std::vector<gc_ptr<Foo> > foos = gc_new std::vector<gc_ptr<Foo> , gc_allocator<T> >;
Could you provide one in some test code which demonstrates that the garbage is actually collected and which handles cycles. For example, a gc_ptr<std::vector<T> > where T contains a gc_ptr<std::vector<T> > which points to the containing vector.
I updated the code in the vault with the example you requested.