view: add 'covers' test

This commit is contained in:
Danny Robson 2018-12-17 14:46:30 +11:00
parent 043dd73677
commit 3925431838

View File

@ -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,