I have a question regarding the std::sort algorithm. Here is my test code:
struct MyTest
{
int m_first;
int m_second;
MyTest(int first = 0, int second = 0) : m_first(first), m_second(second)
{
}
};
int main(int argc,char *argv[])
{
std::vector<MyTest> myVec;
for(int i = 0; i < 10; ++i)
{
myVec.push_back(MyTest(i, i + 1));
}
//Sort the vector in descending order on m_first without using stand alone function or functors
return 0;
}
Is it possible to sort the vector on the variable m_first
without using any stand alone functions or functors? Also, please note that I am not using boost.