From 7f3a269757e8dcd41fb36b27f0f093a982f14e81 Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Fri, 17 May 2013 11:14:12 +0100 Subject: [PATCH] [range] contains method. --- persistent-data/range.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/persistent-data/range.h b/persistent-data/range.h index e1bbc09..2a76abf 100644 --- a/persistent-data/range.h +++ b/persistent-data/range.h @@ -21,6 +21,16 @@ namespace base { return (begin_ == r.begin_ && end_ == r.end_); } + bool contains(T const &v) const { + if (begin_ && v < *begin_) + return false; + + if (end_ && v >= *end_) + return false; + + return true; + } + maybe begin_; maybe end_; };