Re: Copying a container on function call... (Was Re: return_stl_iterator acting as const?)
John Smith <[email protected]>
| Newsgroups | gmane.comp.lang.lua.bind.user |
|---|---|
| Message-ID | <[email protected]> |
Thank you, that worked with a newly created 'return_stl_iterator_pointer' policy. On Thu, Mar 5, 2009 at 12:46 AM, Daniel Wallin <[email protected]> wrote: > John Smith wrote: > > Well another 2 days on this and still no closer to figuring it out... I > > tried to wrap a custom iterator around the class: > > > [...] > > I'm really amazed that it is so difficult, and no one seems to know how > to > > pass a vector of objects to LUA and have LUA modify member variables of > > those objects. It would seem to be the type of problem that luabind was > be > > designed to solve. However every example I can find on the web, the only > > use of a container of objects is to read the values not modify them. So > I'm > > completely at a loss here... > > Unfortunately it can't be done with "return_stl_iterator". That policy > is awful and really needs to be redone properly, but in the meantime the > simplest solution would be to create a new policy using the code in > iterator_policy.hpp, and change the line that says: > > convert_to_lua(L, *self->first); > > to > > convert_to_lua(L, &*self->first); > > or > > convert_to_lua(L, boost::ref(*self->first)); > > That should do it. > > -- > Daniel Wallin > BoostPro Computing > http://www.boostpro.com > > > ------------------------------------------------------------------------------ > Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, > CA > -OSBC tackles the biggest issue in open source: Open Sourcing the > Enterprise > -Strategies to boost innovation and cut costs with open source > participation > -Receive a $600 discount off the registration fee with the source code: > SFAD > http://p.sf.net/sfu/XcvMzF8H > _______________________________________________ > luabind-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/luabind-user > ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ luabind-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/luabind-user