From 3925431838674f949584f23b361618faa748723b Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Mon, 17 Dec 2018 14:46:30 +1100 Subject: [PATCH] view: add 'covers' test --- view.hpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/view.hpp b/view.hpp index f2cfe63f..11c85a21 100644 --- a/view.hpp +++ b/view.hpp @@ -674,6 +674,7 @@ namespace cruft { /////////////////////////////////////////////////////////////////////////// + /// Tests whether an iterator falls within a given view. template constexpr bool intersects (view a, IteratorT b) @@ -682,6 +683,18 @@ namespace cruft { } + ///------------------------------------------------------------------------ + /// Tests whether view `a` inclusively contains view `b`. + template + constexpr bool + covers ( + view const &a, + view const &b + ) { + return a.begin () <= b.begin () && a.end () >= b.end (); + } + + /////////////////////////////////////////////////////////////////////////// template < typename BeginA, typename EndA,