alloc/raw/linear: add constructor from range types
This commit is contained in:
parent
4a92981379
commit
0f4fece00f
@ -30,7 +30,6 @@ linear::linear (void *begin, void *end):
|
|||||||
{
|
{
|
||||||
CHECK_NEZ (begin);
|
CHECK_NEZ (begin);
|
||||||
CHECK_NEZ (end);
|
CHECK_NEZ (end);
|
||||||
|
|
||||||
CHECK_LE (begin, end);
|
CHECK_LE (begin, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#define CRUFT_UTIL_ALLOC_RAW_LINEAR_HPP
|
#define CRUFT_UTIL_ALLOC_RAW_LINEAR_HPP
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
#include <iterator>
|
||||||
|
|
||||||
namespace util::alloc::raw {
|
namespace util::alloc::raw {
|
||||||
// allocate progressively across a buffer without concern for deallocation.
|
// allocate progressively across a buffer without concern for deallocation.
|
||||||
@ -31,6 +32,11 @@ namespace util::alloc::raw {
|
|||||||
|
|
||||||
linear (void *begin, void *end);
|
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);
|
||||||
void* allocate (size_t bytes, size_t alignment);
|
void* allocate (size_t bytes, size_t alignment);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user