concepts: protect tuple concept against empty tuples
This commit is contained in:
parent
fb4e70d146
commit
1427a61745
@ -285,7 +285,7 @@ namespace cruft::concepts {
|
||||
template <typename T>
|
||||
concept tuple = requires (T a, T b)
|
||||
{
|
||||
{ std::tuple_element<0,T> {} };
|
||||
{ std::tuple_size<T>::value == 0 || std::tuple_element<0,T> {} };
|
||||
{ std::tuple_size<T>::value } -> convertible_to<std::size_t>;
|
||||
{ std::tuple_cat (a, b) };
|
||||
};
|
||||
|
@ -8,5 +8,8 @@ int main ()
|
||||
tap.expect (cruft::concepts::container<std::vector<int>>, "vector is a container");
|
||||
tap.expect (!cruft::concepts::container<int>, "int is not a container");
|
||||
|
||||
tap.expect (cruft::concepts::tuple<std::tuple<>>, "tuple<> is a tuple");
|
||||
tap.expect (cruft::concepts::tuple<std::tuple<int>>, "tuple<int> is a tuple");
|
||||
|
||||
return tap.status ();
|
||||
}
|
Loading…
Reference in New Issue
Block a user