alloc/raw/linear: add constructor from range types

This commit is contained in:
Danny Robson 2017-08-30 15:13:43 +10:00
parent 4a92981379
commit 0f4fece00f
2 changed files with 6 additions and 1 deletions

View File

@ -30,7 +30,6 @@ linear::linear (void *begin, void *end):
{
CHECK_NEZ (begin);
CHECK_NEZ (end);
CHECK_LE (begin, end);
}

View File

@ -18,6 +18,7 @@
#define CRUFT_UTIL_ALLOC_RAW_LINEAR_HPP
#include <cstddef>
#include <iterator>
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 <typename T>
linear (T &&view):
linear (std::begin (view), std::end (view))
{ ; }
void* allocate (size_t bytes);
void* allocate (size_t bytes, size_t alignment);