You will need a function or function object or lambda expression (since you can use std::shared_ptr , you already have the C ++ 0x part).
There is nothing in <functional> to help you, but there is something in boost: an indirect iterator
#include <iostream> #include <vector> #include <algorithm> #include <memory> #include <boost/iterator/indirect_iterator.hpp> int main() { std::vector<std::shared_ptr<int>> v1; std::vector<std::shared_ptr<int>> v2; v1.emplace_back( new int(1) ); v2.emplace_back( new int(1) ); bool result = std::equal( boost::make_indirect_iterator(v1.begin()), boost::make_indirect_iterator(v1.end()), boost::make_indirect_iterator(v2.begin())); std::cout << std::boolalpha << result << '\n'; }
Cubbi source share