On Sat, Jun 25, 2011 at 1:26 AM, Stephan Beal <[email protected]> wrote: > On Sat, Jun 25, 2011 at 9:20 AM, Brendan Miller <[email protected]> > wrote:
>> If you don't want to require T to be default constructable, you can't >> create rv on the stack given your scoping requirement. > > It's unfortunately a bit more involved in this case. If a user gives me (T > &), i need to be able to (and can currently) do: > T & t( boundNativeFunction(...) ); > but i can't (it's illegal to) do: > T & t; > Unlocker sentry; > t = boundNativeFunction(); > So what i've done is create a tiny wrapper which heap-allocates the > unlocker, then i: > > UnlockWrapper unl; > T & t( boundNativeFunction(...) ); > unl.Dispose(); > return CastToJS(t); /// i need t to be in scope when i return. Yeah, that looks like a good solution. -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
