I have a function
template<typename T>
static inline bool Contains(T container, const typename T::value_type& value)
{
return std::find(container.begin(), container.end(), value) != container.end();
}
Is there an option to disallow implicit conversions for this function?
This code should fail compilation:
std::vector<int> vec = {1, 2, 3};
Contains(vec, -5.2);
In this post How do I avoid implicit conversions on non-constructing functions? they totally remove the use of some types, which is not the case.
Thanks.