Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CArray<int> arrayOfInts;
- arrayOfInts.Add(7);
- arrayOfInts.Add(114);
- arrayOfInts.Add(3);
- std::sort(arrayOfInts.GetData(), arrayOfInts.GetData()+arrayOfInts.GetSize());
- struct Foo
- {
- int val;
- double priority;
- };
- bool FooPred(const Foo& first, const Foo& second)
- {
- if ( first.val < second.val )
- return true;
- if ( first.val > second.val )
- return false;
- return first.priority < second.priority;
- }
- //...
- CArray<Foo> bar;
- std::sort(bar.GetData(), bar.GetData()+bar.GetSize(), FooPred);
Add Comment
Please, Sign In to add comment