Concepts can always defer to a type trait:
template <typename T> concept C = some_trait<T>::value;
And that trait can be recursive:
template <typename T>
struct some_trait : std::false_type { };
template <std::Integral T>
struct some_trait<T> : std::true_type { };
template <typename T, typename A>
struct some_trait<std::vector<T, A>> : some_trait<T> { };
If you don't mean just vector
, then the last partial specialization can be generalized to:
template <std::Range R>
struct some_trait<R> : some_trait<std::range_value_t<R>> { };
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…