Ok, I have a vector< vector < long >>
, and I want to sort the innermost vectors from smallest to largest - i.e. I expect to have sorted vector < long >
looking like 3,7,21 when sorted.
This has been asked before, but I want to do this very simply so that non-programmers can understand. I've seen that I can create a function or functor to sort as in this question. Is there a way to do this without creating an extra sorting function? I'm doing this as part of a class, and I'm hoping for a way to do this without having to have people hunting all over my code for the simple sorting function.
One possibility is that there may be some way to define the sorting function inside the class function, but this may not be allowed in C++.
Getting back to the point: I've seen several ways to do this, I'm wondering what the simplest way(s) are to sort a vector of integers. Any help is greatly appreciated, as this will probably help out much more than it may seem.