From 0a55b0326ea9452d770668a9feedde2e8ed8ebc7 Mon Sep 17 00:00:00 2001 From: q66 Date: Thu, 13 Aug 2015 23:25:39 +0100 Subject: [PATCH] add algorithm::slice_until (slice1 range from the beginning until range2 not-inclusive) --- ostd/algorithm.hh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ostd/algorithm.hh b/ostd/algorithm.hh index ff73e20..1eb87ff 100644 --- a/ostd/algorithm.hh +++ b/ostd/algorithm.hh @@ -347,6 +347,11 @@ bool equal(R range1, R range2) { return range2.empty(); } +template +R slice_until(R range1, R range2) { + return range1.slice(0, range1.distance_front(range2)); +} + /* algos that modify ranges or work with output ranges */ template