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.
I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...
Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...