diff options
Diffstat (limited to 'vespalib/src/vespa/vespalib/util/memory_allocator.h')
-rw-r--r-- | vespalib/src/vespa/vespalib/util/memory_allocator.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/vespalib/src/vespa/vespalib/util/memory_allocator.h b/vespalib/src/vespa/vespalib/util/memory_allocator.h index 2bcd7e5889d..e9a494f3e6f 100644 --- a/vespalib/src/vespa/vespalib/util/memory_allocator.h +++ b/vespalib/src/vespa/vespalib/util/memory_allocator.h @@ -8,6 +8,17 @@ namespace vespalib::alloc { +class PtrAndSize { +public: + PtrAndSize() noexcept : _ptr(nullptr), _sz(0ul) {} + PtrAndSize(void * ptr, size_t sz) noexcept; + void * get() const noexcept { return _ptr; } + size_t size() const noexcept { return _sz; } +private: + void * _ptr; + size_t _sz; +}; + /* * Abstract base class for allocating memory at a low level. */ @@ -15,7 +26,6 @@ class MemoryAllocator { public: static constexpr size_t PAGE_SIZE = 4_Ki; static constexpr size_t HUGEPAGE_SIZE = 2_Mi; - using PtrAndSize = std::pair<void *, size_t>; MemoryAllocator(const MemoryAllocator &) = delete; MemoryAllocator & operator = (const MemoryAllocator &) = delete; MemoryAllocator() = default; |