13
0

Lua: allow to reserve STL vector size

This commit is contained in:
Robin Gareus 2023-07-12 18:23:51 +02:00
parent 72522dd05d
commit f2c5f9da25
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -2092,10 +2092,12 @@ public:
Class<std::vector<T> > beginStdVector (char const* name)
{
typedef std::vector<T> LT;
typedef typename std::vector<T>::size_type T_SIZE;
return beginConstStdVector<T> (name)
.addVoidConstructor ()
.addFunction ("push_back", (void (LT::*)(const T&))&LT::push_back)
.addFunction ("clear", (void (LT::*)())&LT::clear)
.addFunction ("reserve", (void (LT::*)(T_SIZE))&LT::reserve)
.addExtCFunction ("to_array", &CFunc::vectorToArray<T, LT>)
.addExtCFunction ("add", &CFunc::tableToList<T, LT>);
}