title: Creating a function that returns true if element is in unordered_set, how to deal with templates?
body: <p>I have this unordered_set:</p>
  
  <pre><code>std::unordered_set&lt;Category, CategoryHash, CategoryEqual&gt;
  </code></pre>
  
  <p>I have to do this:</p>
  
  <pre><code>if (allowTheseCategories-&gt;find(message.category) != allowTheseCategories-&gt;end())
  </code></pre>
  
  <p>in order to find if an element exists in the <code>unordered_set</code></p>
  
  <p>I wanted to write a function that returns true or false if element exists in unordered_set, but I quickly figured out that it'd have to deal with types:</p>
  
  <pre><code>template &lt;typename T, Typename U, typename V&gt;
  bool unorderedSetHasElement(std::unordered_set&lt;T, U, V&gt;&amp; unorderedSet, T element) {
      return unorderedSet-&gt;find(element) != unorderedSet-&gt;end()
  }
  </code></pre>
  
  <p>and calling this function would not be pratical, since I'd have to do:</p>
  
  <pre><code>if (unorderedSetHasElement&lt;Category, CategoryHash, CategoryEqual&gt;(...))
  </code></pre>
  
  <p>Is there any way to create a simple function that accepts <code>unordered_set</code>? Or is there a way to extend <code>unordered_set</code> to have this function?</p>