diff --git a/include/chaiscript/dispatchkit/bootstrap_stl.hpp b/include/chaiscript/dispatchkit/bootstrap_stl.hpp index b86b1e44..b9e0a9f5 100644 --- a/include/chaiscript/dispatchkit/bootstrap_stl.hpp +++ b/include/chaiscript/dispatchkit/bootstrap_stl.hpp @@ -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 ModulePtr reservable_type(const std::string &type) diff --git a/unittests/vector_reserve.chai b/unittests/vector_reserve.chai index 764002af..68c8dbdb 100644 --- a/unittests/vector_reserve.chai +++ b/unittests/vector_reserve.chai @@ -3,5 +3,5 @@ load_module("stl_extra"); auto uint16v = u16vector(); uint16v.reserve(5); -assert_true(uint16v.size() >= 5); +assert_true(uint16v.capacity() >= 5);