I would like to know if we can sort a pre created set. When I first create the set s_p2, I sort using a different element point.getLength(). but after user input i would like to sort the items according to the x value point.getX(). How i do this ?
It seems like set container does not have a sort function. And i am advised to use vector. But sets are able to store unique elements only.
Q1: How can i sort a set depending on the criteria
Q2: If set is unable to do this than which STL container is the best choice and how can i sort the elements in the container.
See Question&Answers more detail:os