cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
Sorting <vector> of objects
Sorting <vector> of objects
Nov 20, 2011 at 7:26pm UTC
closed account (
10oTURfi
)
I am looking for a simple way to sort <vector> of custom objects by value stored in member var of those objects. Is it possible to bubble sort it with swap?
Hopefully that made sense :)
Last edited on
Nov 20, 2011 at 7:28pm UTC
Nov 20, 2011 at 7:28pm UTC
hamsterman
(4538)
See
http://cplusplus.com/reference/algorithm/sort/
Note that you'll have to write a function to compare two elements.
Of course, you could write the same yourself..
Last edited on
Nov 20, 2011 at 7:29pm UTC
Topic archived. No new replies allowed.