LuaBridge: Dedicated type for pointer-lists and const version
"class C*" cannot be defined nor resolved, so STL containers to class instance pointers need to be special-cased.
This commit is contained in:
parent
37dc93b40a
commit
71fd94b422
|
@ -1864,7 +1864,34 @@ public:
|
|||
}
|
||||
|
||||
template <class T>
|
||||
Class<std::vector<T> > beginStdVector (char const* name)
|
||||
Class<std::list<T*> > beginConstStdCPtrList (char const* name)
|
||||
{
|
||||
typedef T* TP;
|
||||
typedef std::list<TP> LT;
|
||||
return beginClass<LT> (name)
|
||||
.addVoidConstructor ()
|
||||
.addFunction ("empty", <::empty)
|
||||
.addFunction ("size", <::size)
|
||||
.addFunction ("reverse", <::reverse)
|
||||
.addFunction ("front", static_cast<const TP& (LT::*)() const>(<::front))
|
||||
.addFunction ("back", static_cast<const TP& (LT::*)() const>(<::back))
|
||||
.addExtCFunction ("iter", &CFunc::listIter<T*, LT>)
|
||||
.addExtCFunction ("table", &CFunc::listToTable<T*, LT>);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
Class<std::list<T*> > beginStdCPtrList (char const* name)
|
||||
{
|
||||
typedef T* TP;
|
||||
typedef std::list<TP> LT;
|
||||
return beginConstStdCPtrList<T> (name)
|
||||
.addFunction ("unique", (void (LT::*)())<::unique)
|
||||
.addFunction ("push_back", (void (LT::*)(const TP&))<::push_back);
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
Class<std::vector<T> > beginConstStdVector (char const* name)
|
||||
{
|
||||
typedef std::vector<T> LT;
|
||||
typedef typename std::vector<T>::reference T_REF;
|
||||
|
@ -1874,13 +1901,23 @@ public:
|
|||
.addVoidConstructor ()
|
||||
.addFunction ("empty", <::empty)
|
||||
.addFunction ("size", <::size)
|
||||
.addFunction ("push_back", (void (LT::*)(const T&))<::push_back)
|
||||
.addFunction ("at", (T_REF (LT::*)(T_SIZE))<::at)
|
||||
.addExtCFunction ("add", &CFunc::tableToList<T, LT>)
|
||||
.addExtCFunction ("iter", &CFunc::listIter<T, LT>)
|
||||
.addExtCFunction ("table", &CFunc::listToTable<T, LT>);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
Class<std::vector<T> > beginStdVector (char const* name)
|
||||
{
|
||||
typedef std::vector<T> LT;
|
||||
return beginConstStdVector<T> (name)
|
||||
.addVoidConstructor ()
|
||||
.addFunction ("push_back", (void (LT::*)(const T&))<::push_back)
|
||||
.addExtCFunction ("add", &CFunc::tableToList<T, LT>);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
template <class T>
|
||||
|
|
Loading…
Reference in New Issue
Block a user