MCPcopy Create free account
hub / github.com/IntegralPilot/wasm_os / reserve

Method reserve

stdlib/cpp/vector.hpp:128–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126 }
127
128 void reserve(size_type new_capacity) {
129 if (new_capacity > capacity_) {
130 T* new_data = allocate(new_capacity);
131
132 if (!new_data) {
133 for(;;);
134 }
135
136 for (size_type i = 0; i < size_; ++i) {
137 new (&new_data[i]) T(std::move(data_[i]));
138 data_[i].~T();
139 }
140
141 deallocate(data_);
142 data_ = new_data;
143 capacity_ = new_capacity;
144 }
145 }
146
147 void resize(size_type count) {
148 if (count < size_) {

Callers 1

mainFunction · 0.80

Calls 1

moveFunction · 0.85

Tested by

no test coverage detected