Author Message

<  beginners  ~  Sorting OfPoint List

PostPosted: Wed Dec 23, 2009 9:23 pm
Joined: Thu Oct 29, 2009 3:00 pmPosts: 64
Hi @ all,



I am really confused, i have a list of Datatype ofPoint, where i want to sort the list by the x value. Is there any approach i can follow?

thank you very much


Offline Profile
PostPosted: Wed Dec 23, 2009 9:48 pm
User avatarJoined: Tue May 27, 2008 10:03 amPosts: 691Location: London, UK
yup, create a function that takes 2 ofPoints, and returns p1.x < p2.x. then use the sort method of the list passing that function as a parameter

http://www.cplusplus.com/reference/stl/list/sort/


Offline Profile
PostPosted: Wed Dec 23, 2009 10:02 pm
Joined: Thu Oct 29, 2009 3:00 pmPosts: 64
thanks mehmet, i will give it a try


Offline Profile

Display posts from previous:  Sort by:

All times are UTC
Page 1 of 1
3 posts
Users browsing this forum: No registered users and 1 guest
Search for:
Post new topic  Reply to topic
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
cron