
27 Feb
2005
27 Feb
'05
6:44 p.m.
Consider this code: vector<int> coll; // ... push back some values vector<int*> ptrcoll; // ... push back pointers to the values of coll indirect_iterator< vector<int*>::iterator > begin(ptrcoll.begin()), end(ptrcoll.end()); sort( begin, end, less<int> ); -- My question: After the sort statement, coll is sorted, right? (and ptrcoll is not). However, I need to sort a vector of pointers according to a predicate which applies to non-pointers. In this case, I want to sort ptrcoll, according to the less-relation on the pointees in coll. How can I achieve that? -- Matthias Kaeppler