Answer the question
In order to leave comments, you need to log in
What do the inscriptions Ty, Alloc, Allocator mean in the error?
I'm trying to remove a class object from a vector and a tooltip pops up. It has this entry. What does she mean?
missing instances overloaded function "std::vector<_Ty, _Alloc>::erase [with _Ty=A *, _Alloc=std::allocator ]"
Explain what _Ty_Alloc, c_Ty, _Alloc, allocator is.
Answer the question
In order to leave comments, you need to log in
You tried to run a function vector<A*>::erase
with unusual parameters. What - the error does not say, here are all the overloads.
https://ru.cppreference.com/w/cpp/container/vector...
That is, the function takes one or two iterators.
For example, if you want to delete a value but don't know where, you can't just erase it. But you must…
// Спрессовать без перевыделения памяти, получить новый конец
std::vector<A*>::iterator newEnd = std::remove(v.begin(), v.end(), whatToDelete);
// Удалить освободившийся хвост скопом!
v.erase(newEnd, v.end());
v.erase(v.begin() + indexToDelete);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question