luabind and std::multimap
irukandji <[email protected]> Tue, 14 Feb 2012 13:33:16 +0100
| Newsgroups | gmane.comp.lang.lua.bind.user |
|---|---|
| Message-ID | <[email protected]> |
Hi everyone, sorry for sending this mail but i wasnt able to find the
answer anywhere else.
I dont want to make a wrapper around multimap or convert the data to a
table as this brings
useless copying of data, so the idea was to export the std::pair class
and use it as it is
from multimap iterators. The ::first is working just fine and outputs
the data stored as a key, but
the ::second fails and i am unable to figure out why. Can anyone maybe
at least say that this is
not possible so i can stop banging my head against the wall? :) Thank
you in advance...
// c++ part
std::multimap<std::string, std::string> m_multimap;
luabind::module(pLuaState)
[
luabind::class_< std::pair<const std::string, std::string> >
("MultimapPair")
.property("key", &std::pair<const std::string, std::string>::first )
.property("val", &std::pair<const std::string, std::string>::second )
];
luabind::module(pLuaState)
[
luabind::class_<CTest>("CTest")
.def_readwrite("multimap", &CTest::m_multimap,
luabind::return_stl_iterator)
];
// luapart
function testclass( ctest )
for data in ctest.multimap do
trace(data.key)
trace(data.value)
end
end
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d