title: C++ map custom hash function gives compile error when using "count" function
body: <p>I tried to make a custom hash function, which transforms original string to &quot;the number of times each alphabet appears in a given string&quot;. It goes like this :</p>
  <pre><code>struct hash_nums {
      string operator()(const string&amp; s) const {
          
          vector&lt;int&gt; arr(26, 0);
          for (char c : s) {
              ++arr[c-'a'];
          }
          string str(arr.begin(), arr.end());
          return str;
      }
  };
  </code></pre>
  <p>and in main function, I wrote code like this :</p>
  <pre><code>unordered_map&lt;string, vector&lt;string&gt;, hash_nums&gt; um;
  ...
  for (string s : strings)
      if (um.count(s)) // do something
  </code></pre>
  <p>but when I use <code>um.count(s)</code>, it gives me this error :</p>
  <pre><code>Line 32: Char 20: note: in instantiation of member function 'std::unordered_map&lt;std::__cxx11::basic_string&lt;char&gt;, std::vector&lt;std::__cxx11::basic_string&lt;char&gt;, std::allocator&lt;std::__cxx11::basic_string&lt;char&gt;&gt;&gt;, Solution::hash_nums, std::equal_to&lt;std::__cxx11::basic_string&lt;char&gt;&gt;, std::allocator&lt;std::pair&lt;const std::__cxx11::basic_string&lt;char&gt;, std::vector&lt;std::__cxx11::basic_string&lt;char&gt;, std::allocator&lt;std::__cxx11::basic_string&lt;char&gt;&gt;&gt;&gt;&gt;&gt;::count' requested here
              if (um.count(s)) {
                     ^
  </code></pre>
  <p>I used custom hash function for std::pair, and it didn't give me these errors.
  Also, only declaring unordered_map compiles just fine.</p>
  <p>What has gone wrong?</p>