From 0f4fece00f2a2649f998242ddf3f18e4d03559cf Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Wed, 30 Aug 2017 15:13:43 +1000 Subject: [PATCH] alloc/raw/linear: add constructor from range types --- alloc/raw/linear.cpp | 1 - alloc/raw/linear.hpp | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/alloc/raw/linear.cpp b/alloc/raw/linear.cpp index 5c1d47e9..65d7097a 100644 --- a/alloc/raw/linear.cpp +++ b/alloc/raw/linear.cpp @@ -30,7 +30,6 @@ linear::linear (void *begin, void *end): { CHECK_NEZ (begin); CHECK_NEZ (end); - CHECK_LE (begin, end); } diff --git a/alloc/raw/linear.hpp b/alloc/raw/linear.hpp index aec0f475..f5df05cb 100644 --- a/alloc/raw/linear.hpp +++ b/alloc/raw/linear.hpp @@ -18,6 +18,7 @@ #define CRUFT_UTIL_ALLOC_RAW_LINEAR_HPP #include +#include namespace util::alloc::raw { // allocate progressively across a buffer without concern for deallocation. @@ -31,6 +32,11 @@ namespace util::alloc::raw { linear (void *begin, void *end); + template + linear (T &&view): + linear (std::begin (view), std::end (view)) + { ; } + void* allocate (size_t bytes); void* allocate (size_t bytes, size_t alignment);