
template< typename T > typename std::enable_if< AlwaysTrue<T>::value && contract::std::EqualityComparable<T>::value, bool>::type equal1 ( T const& a, T const& b ) { return a == b; }
Just curious, but what is the purpose of AlwaysTrue? If it's always true, why not omit it?
And given this, I personally don't see the need for specifying concepts in place of typename or using requires. In other words, I think the above use of enable_if is sufficient and the following syntax is not necessary (even if it's part of N3351):
template< AlwaysTrue T > requires contract::std::EqualityComparable<T> bool equal1 ( T const& a, T const& b ) { return a == b; }
From a technical perspective, how would you specify this behavior for
Lots of reasons, but mostly it clearly delineates what is required from what is returned. the standard? Can you do it in a way that guarantees the same behavior for all of the following, equivalent declarations? // std::enable_if template <typename T> typename std::enable_if<Eq<T>::value, bool>::type f(T x) // Boost enable_if template <typename T> typename boost::enable_if<Eq<T>, bool>::type f(T x) // Origin style template <typename T> Requires<Eq<T>(), bool> f(T x) Should the compiler know that all of these are the same? How could you guarantee that? Would the behavior be different for the std::enable_if? If Requires was an alias to std::enable_if (it is), does that get the same behavior? Libraries are great for helping figure out what you want, but you're going to hit a wall at some point. I think "requires" is one of those walls. Andrew