title: How can I write a template to check if a given value is in an array
body: <p>Per an answer to <a href="https://stackoverflow.com/questions/19299508/how-can-i-check-if-given-int-exists-in-array">this previous question</a>, I wrote the template below which should return true if the array contains the passed value, and false otherwise.</p>
  
  <pre><code>template &lt;typename Type&gt;
  bool Contains(const Type container[], const Type&amp; value) {
    return std::any_of(
        std::begin(container), std::end(container),
        [&amp;value](const Type&amp; contained_value) { return value == contained_value; });
  }
  </code></pre>
  
  <p>When I try to compile, I get the following error:</p>
  
  <pre><code>error: no matching function for call to 'begin'
        std::begin(container), std::end(container),
  </code></pre>
  
  <p>What is causing <code>std::begin</code> to fail? The <a href="http://en.cppreference.com/w/cpp/iterator/begin" rel="nofollow noreferrer">std::begin documentation</a> shows it works with arrays. In this specific instance, I am instantiating the template on an enum (not an enum class).</p>