How to define a concept that checks for the size of a parameter pack?
I want a concept that requires parameter packs to be of size > 0.
I wrote this:
1 2
|
template<typename...T>
concept NonEmpty = requires {sizeof...(T) > 0; };
|
This does no checking. For instance:
1 2 3
|
template<typename T1, typename ... T> requires NonEmpty<T...>
struct Group<T1, T...> : Group<T...>
///// etc
|
What am I doing wrong?
Doesn't this just check if sizeof...(T) > 0
is a valid expression?
This seems to work:
1 2
|
template<typename...T>
concept NonEmpty = sizeof...(T) > 0;
|
Last edited on
Topic archived. No new replies allowed.