I wrote a class and defined some variables in my program.Then I want to put them to a vector(std::vector<myclass> v1) and sort them with the std::sort().
When I compile it,my compiler,mingw gcc4.3.5,told me that the std::sort() is error! I change my class to int, it works fine!
I have defined the class with operator< and operator ==
Are there someone who can tall me what I should do?
After fixing the comma typo on line 28, I was getting a "discards qualifiers" error. They usually have something to do with the const-ness of your object. Adding const to the < operator made it all good. This works:
Sounds like you are compiling with debug info. Either compile without -g option or run strip -a on the executable (-a option is off the top of my head).