#include #include #include #include #include int main() { typedef boost::shared_ptr ptr_type; typedef std::map hashes_type; std::vector v(25); hashes_type hashes; boost::hash hasher; ptr_type null_ptr; ++hashes[hasher(null_ptr)]; for (int i(0); i < 25; ++i) { v[i] = ptr_type(new int(i)); std::size_t const hash(hasher(v[i])); ++hashes[hash]; } for (hashes_type::iterator it(hashes.begin()), end(hashes.end()); it != end; ++it) { std::cout << it->first << ": " << it->second << '\n'; } }