I would like to write a concept that would allow me to verify if a given statement, using ADL, is valid and has a proper return type.
In my specific case, I want to write a String concept that should enforce the following requirements:
The type has
beginandendsemantics for both itsconstand non-constflavors:// Akin to what this function does for `T` and `T const` template< typename T > auto test(T& t) { using std::begin; return begin(t); } // calling test with `T` and `T const` should be valid.The return types of
beginandendare consistent for bothconstand non-constflavors and they satisfy thestd::contiguous_iteratorconcept.
So far I went with a trait implementation like the following:
namespace Adl {
using std::begin;
template< typename T >
using HasBeginT = decltype(begin(std::declval< T >()));
}
template< typename T >
using HasBegin = std::experimental::is_detected< Adl::HasBeginT, T >;
But I would like to directly embed this ADL usage in the definition of my constraint instead.