Sequoia
Loading...
Searching...
No Matches
sequoia::faithful_range Concept Reference

Similar to std::range but excludes the case where dereferencing yields the same type as the range. More...

#include <Concepts.hpp>

Concept definition

template<class T>
concept sequoia::faithful_range = requires(T& t) {
std::ranges::begin(t);
std::ranges::end(t);
requires (!std::same_as<std::remove_cvref_t<decltype(*std::ranges::begin(t))>, std::remove_cvref_t<T>>);
}
Similar to std::range but excludes the case where dereferencing yields the same type as the range.
Definition: Concepts.hpp:91

Detailed Description

Similar to std::range but excludes the case where dereferencing yields the same type as the range.

This avoids treating std::filesystem::path as a range in circumstances where, to do so, would be inappropriate. The implementation of faithful_range is not complete; it deals with the simplest circular case but doesn't take into account more complicated possibilites. A full treatment could almost certainly be readily implemented if/when reflection is properly supported in C++.