concepts: don't check end -> legacy_iterator in iterable
This doesn't work for sentinel ranges. Rather we mainly care that the begin/end results can be compared.
This commit is contained in:
parent
e151d5c8c3
commit
f141cb3e95
@ -53,13 +53,19 @@ namespace cruft::concepts {
|
||||
|
||||
|
||||
/// Anything that can be looped over using begin/end
|
||||
///
|
||||
/// We don't check end against legacy_iterator because that won't work for std::default_sentinel.
|
||||
/// Rather, the important part is that it's equality comparable against whatever std::begin returns.
|
||||
template <typename T>
|
||||
concept iterable = requires (T t)
|
||||
{
|
||||
{ std::begin (t) } -> named::legacy_iterator;
|
||||
{ std::end (t) } -> named::legacy_iterator;
|
||||
std::begin (t) == std::end (t);
|
||||
std::begin (t) != std::end (t);
|
||||
|
||||
{ std::cbegin (t) } -> named::legacy_iterator;
|
||||
{ std::cend (t) } -> named::legacy_iterator;
|
||||
std::cbegin (t) == std::cend (t);
|
||||
std::cbegin (t) != std::cend (t);
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user