view: add 'covers' test
This commit is contained in:
parent
043dd73677
commit
3925431838
13
view.hpp
13
view.hpp
@ -674,6 +674,7 @@ namespace cruft {
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
/// Tests whether an iterator falls within a given view.
|
||||
template <typename IteratorT>
|
||||
constexpr bool
|
||||
intersects (view<IteratorT> a, IteratorT b)
|
||||
@ -682,6 +683,18 @@ namespace cruft {
|
||||
}
|
||||
|
||||
|
||||
///------------------------------------------------------------------------
|
||||
/// Tests whether view `a` inclusively contains view `b`.
|
||||
template <typename IteratorA, typename IteratorB>
|
||||
constexpr bool
|
||||
covers (
|
||||
view<IteratorA,IteratorB> const &a,
|
||||
view<IteratorA,IteratorB> const &b
|
||||
) {
|
||||
return a.begin () <= b.begin () && a.end () >= b.end ();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <
|
||||
typename BeginA, typename EndA,
|
||||
|
Loading…
Reference in New Issue
Block a user