boostorg / unordered

Boost.org unordered module
http://boost.org/libs/unordered
Boost Software License 1.0
62 stars 55 forks source link

boost::unordered_multimap::find compile error with info: no type named ‘policy’ in ... #237

Closed 530967061 closed 5 months ago

530967061 commented 5 months ago
  boost::unordered_multimap<std::string, std::string> test;
  test.find("", boost::hash<std::string>(), std::equal_to<>());  // this is OK
  ((const boost::unordered_multimap<std::string, std::string> &)m)
      .find("", boost::hash<std::string>(), std::equal_to<>());  // can not compile
    template <class K, class T, class H, class P, class A>
    template <class CompatibleKey, class CompatibleHash,
      class CompatiblePredicate>
    typename unordered_multimap<K, T, H, P, A>::iterator
    unordered_multimap<K, T, H, P, A>::find(CompatibleKey const& k,
      CompatibleHash const& hash, CompatiblePredicate const& eq)
    {
      return table_.transparent_find(k, hash, eq);
    }

    template <class K, class T, class H, class P, class A>
    template <class CompatibleKey, class CompatibleHash,
      class CompatiblePredicate>
    typename unordered_multimap<K, T, H, P, A>::const_iterator
    unordered_multimap<K, T, H, P, A>::find(CompatibleKey const& k,
      CompatibleHash const& hash, CompatiblePredicate const& eq) const
    {
      return const_iterator(
        table_.find_node_impl(table::policy::apply_hash(hash, k), k, eq));  // use 'return table_.transparent_find(k, hash, eq);' instead?
    }