Re: Derived Lua objects in C++ containers (with smart pointers)
"Christian" <[email protected]> Mon, 8 Jul 2013 14:04:59 +0200
| Newsgroups | gmane.comp.lang.lua.bind.user |
|---|---|
| Message-ID | <[email protected]> |
On Monday, July 08, 2013 1:08 PM, Glen Fraser [mailto:[email protected]] wrote: > The complicating factor (maybe) is that I'd like to use smart pointers in the containing > STL vector, and I don't see how to use both luabind::wrap_base and a smart pointer at the > same time, in the class_ binding. I think you identified the problem correctly. Have you read http://www.rasterbar.com/products/luabind/docs.html#smart-pointers ? You need to specify ofPtr as an template argument when registering your class and make sure that a get_pointer() function is available in the same namespace as ofPtr (global is only sufficient if ofPtr is itself global). > (in the below code, assume [...] ofPtr is just shared_ptr) boost::shared_ptr? Then just specify ofPtr as template argument, as said above, and you should be done. If not, you additionally need to supply an appropriate get_pointer() function. For std::shared_ptr, you can use a header I made for this purpose (just include it): http://github.com/Oberon00/luabind/blob/master/luabind/std_shared_ptr_converter.hpp I hope I could help, Christian ------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev