#include#include "willbeheapvector.hpp" int main() { WillBeHeapVector vec = {1, 2, 3}; std::cout << vec.size() << std::endl; // Output: 3 std::cout << vec[0] << std::endl; // Output: 1 vec.push_back(4); std::cout << vec.size() << std::endl; // Output: 4 return 0; }
#includeThis example demonstrates the usage of `reserve` method in `WillBeHeapVector` to allocate memory in advance and avoid reallocations during the vector's growth. Package library: `willbeheapvector`.#include "willbeheapvector.hpp" struct Student { std::string name; int age; }; int main() { WillBeHeapVector vec; vec.reserve(1000); for (int i = 0; i < 1000; i++) { vec.push_back({"John Doe", 20}); } return 0; }