#include #include #include #include #include using boost::shared_ptr; using std::vector; bool sortfunction(shared_ptr x, shared_ptr y) { return *x < *y; } bool printfunction(shared_ptr x) { std::cout << *x << std::endl; } int main(int argc, char **argv) { vector > vec; vec.push_back(shared_ptr(new int(9))); vec.push_back(shared_ptr(new int(5))); vec.push_back(shared_ptr(new int(7))); std::sort(vec.begin(), vec.end(), &sortfunction); std::for_each(vec.begin(), vec.end(), &printfunction); return EXIT_SUCCESS; }