On Wed, Aug 10, 2016 at 11:46 AM Kit Adams <[email protected]> wrote:

> Thank you for those links, they are a great help.
>
> Is there an "unprotect_from_gc(T* val)"?
>
> I am looking for a smart pointer a bit like v8's UniquePersistent<>.
>
> I guess I could make one that searched through the array for the value in
> order to remove it (in the smart pointer's dtor).
>
>
No, I didn't need unprotect so far. Iterating over the array is one way,
another option would be to keep a std::map along with the array to
immediately find the index. I think removing elements from the array is
cumbersome, it's probably best to set the value to null (by assigning a
jl_box_voidpointer(nullptr), setting a jl_value_t* to null directly feels
wrong) and depending on how many times objects are added / removed keep a
stack of the empty spots in the array so they can be reused.

Reply via email to