I have a function:
void get_good_items(const std::vector<T>& data,std::vector<XXX>& good_items);
This function should check all data and find elements that satisfy the condition and return where they are in good_items.
which is better than std::vector<XXX> ?
std::vector<size_t> , which contains all the good indexes.std::vector<T*> , which contain pointers to elements.std::vector<std::vector<T>::iterator> , which contains iterators for the elements.- other
EDIT:
What should I do with good_items ? Many things ... one of them is to remove them from the vector and save them elsewhere. maybe something else later
EDIT 2:
One of the most important for me is how to quickly access elements in data depending on the good_items structure?
EDIT 3:
I just changed that my thought was wrong. Isn't it better to keep the original pointers (or smart ones) as elements of a vector so that I can keep the real values ββof the vector (which are pointers), and I'm not afraid of a heavy copy, because they are just pointers?
c ++ iterator pointers vector c ++ 11
Humam helfawi
source share