This is a kind of follow-up question to How to detect a template function should impose a more strict concept.
I have some code that looks like this:
#include <iterator>
template<std::random_access_iterator Iter>
auto compare(Iter i1, Iter i2)
{
return i1 < i2;
}
I then realise I can replace less than with not equal to:
template<std::random_access_iterator Iter>
auto compare(Iter i1, Iter i2)
{
return i1 != i2;
}
Now the concept constrain can be downgraded to forward_iterator
. Is there a way to help me detect this, apart from a careful code review?