Why do you need to store int* anyways? Either store it as vector<int> or vector< vector<int> >
Well perhaps it is a bad idea, BUT I have a vector of objects which contains int values, and while I don't want to change the ordering of the objects themselves, I do wish to sort some of the int values.
// some code...
// push_back myClass objects
// push_back m_val for every myClass in mVec
std::sort(pVec.begin(), pvec.end(), pComp);
// Now use the sorted values...
// pVec then goes out of scope
It seems to me this is a efficient solution b/c I'm only creating pointers (or I might use iterators instead of pointers). Bad idea?
I don't actually want to sort the myClass objects. Only the values contained in myClass. It might seem like an unusual thing to be doing, but in the real application, myClass is a glorified struct that is part of a hierarchical data grouping. I need to sort the m_vals contained in myClass, and I need to do so efficiently. A vector should be better than a multi-index for this purpose although Boost is good to have in my back pocket. Thank you.