Add capacity check; fix vector_reserve unittest
This commit is contained in:
parent
cdb9dcc154
commit
62e34c097c
@ -315,6 +315,7 @@ namespace chaiscript
|
||||
void reservable_type(const std::string &/*type*/, Module& m)
|
||||
{
|
||||
m.add(fun([](ContainerType *a, typename ContainerType::size_type n) { return a->reserve(n); } ), "reserve");
|
||||
m.add(fun([](const ContainerType *a) { return a->capacity(); } ), "capacity");
|
||||
}
|
||||
template<typename ContainerType>
|
||||
ModulePtr reservable_type(const std::string &type)
|
||||
|
@ -3,5 +3,5 @@ load_module("stl_extra");
|
||||
auto uint16v = u16vector();
|
||||
|
||||
uint16v.reserve(5);
|
||||
assert_true(uint16v.size() >= 5);
|
||||
assert_true(uint16v.capacity() >= 5);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user