3 ms·
template <typename T> void remove(std::vector<T>& v, std::size_t i) { std::swap(v[i], v.back()); v.resize(v.size() - 1); }
by mihai_ionic 13y ago
template <typename T>
void remove(std::vector<T>& v, std::size_t i)
{
std::swap(v[i], v.back());
v.resize(v.size() - 1);
}
- detrino 13y agoThat's just a different algorithm that produces different results than .erase() and has nothing to do with cache.