From dafd5a17b521631a055e95bb5e074ccc0d01d63a Mon Sep 17 00:00:00 2001 From: q66 Date: Wed, 17 Jun 2015 00:44:41 +0100 Subject: [PATCH] loosen up PointerRange ctor rules (allow construction of PointerRange from any PointerRange where U * is convertible to T *) --- octa/range.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/octa/range.h b/octa/range.h index 43d854c..5b8cacf 100644 --- a/octa/range.h +++ b/octa/range.h @@ -746,11 +746,14 @@ template struct PointerRange: InputRange, FiniteRandomAccessRangeTag, T> { PointerRange(): p_beg(nullptr), p_end(nullptr) {} - PointerRange(const PointerRange &v): p_beg(v.p_beg), - p_end(v.p_end) {} PointerRange(T *beg, T *end): p_beg(beg), p_end(end) {} PointerRange(T *beg, octa::Size n): p_beg(beg), p_end(beg + n) {} + template + PointerRange(const PointerRange &v, octa::EnableIf< + octa::IsConvertible::value, bool + > = true): p_beg(&v[0]), p_end(&v[v.size()]) {} + PointerRange &operator=(const PointerRange &v) { p_beg = v.p_beg; p_end = v.p_end;