Per an answer to this previous question, I wrote the template below which should return true if the array contains the passed value, and false otherwise.
template <typename Type>
bool Contains(const Type container[], const Type& value) {
return std::any_of(
std::begin(container), std::end(container),
[&value](const Type& contained_value) { return value == contained_value; });
}
When I try to compile, I get the following error:
error: no matching function for call to 'begin'
std::begin(container), std::end(container),
What is causing std::begin
to fail? The std::begin documentation shows it works with arrays. In this specific instance, I am instantiating the template on an enum (not an enum class).