On Thu, Mar 11, 2010 at 4:46 PM, Seiji Sam Lee <[email protected]> wrote:
> Well, it must be simple:
>
>
>
> I need to clone a Value (Handle<Value> value, for example) I need a copy of
> ‘value’ which I can store in a table hash and use latter, and ok dispose it.
>
>
>
> I was looking for a Clone method, but only Object objects have it. Any idea?
>

Are you sure you want a clone of the value? Or do you just want a copy
of the reference that survives the local scope?
Persistent<Value>::New(handle_of_value) would give you that.

If you actually want to clone the value, that only makes sense on
Object. So you need to do something like this:
Handle<Value> clone = Persistent<Value>::New(value->IsObject() ?
Handle<Object>::Cast(value)->Clone() : value);

Don't forget to Clear() and Dispose() the persistent handles.

>
>
> --
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to