#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'; }
Using C++ std::equal on a container of shared_ptr
最新推荐文章于 2023-08-14 15:18:52 发布