I don't think STL has anything that will (significantly) help, other than using vectors to store point data. You'll need to implement your own data structure, similar to the one I described above.
>>would you mind giving an example of how using your structure, I can insert the points, and sort them by each coordinate.
I just made that data structure up, so I don't have any code for manipulating it. However, it should be fairly simple to adapt ordinary linked-list algorithms to the purpose.
For example, if you only consider one element of each node (i.e. node), then the datastructure effectively becomes a singly-linked list, with node->next being your 'next' pointer. So for example, when iterating along each list, you might have:
The vector subscript tells you which axis you're dealing with. This is basically representing a point as an ordered triplet, except that we also bundled in a pointer, which allows us to link the individual coordinates into lists.
Node *xhead,*yhead,*zhead, *xcoord_next, *ycoord_next, *zcoord_next;
xcoord_next = (*xhead).next;
ycoord_next = (*yhead).next;
zcoord_next = (*zhead).next;
xcoord_next = (*xcoord_next).next;
ycoord_next = (*ycoord_next).next;
zcoord_next = (*zcoord_next).next;
So you can see, once you insert a point at an arbitrary position in the structure, and re-form the links along each coordinate axis, it's a simple matter to run the structure through a slightly modified list-sorting algorithm N times, changing the vector subscript each time. The result: N sorted lists, using the same 'point' structures.