From 0e97044adf8f0c198a3817d4e0f96ff3167e7edf Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Thu, 31 Aug 2017 13:48:33 +1000 Subject: [PATCH] allow/raw: rename base as begin --- alloc/raw/affix.hpp | 4 ++-- alloc/raw/aligned.hpp | 4 ++-- alloc/raw/dynamic.hpp | 16 ++++++++-------- alloc/raw/linear.cpp | 4 ++-- alloc/raw/linear.hpp | 10 ++++++++-- alloc/raw/null.cpp | 4 ++-- alloc/raw/null.hpp | 4 ++-- alloc/raw/stack.cpp | 4 ++-- alloc/raw/stack.hpp | 4 ++-- test/alloc/linear.cpp | 2 +- test/alloc/stack.cpp | 2 +- 11 files changed, 32 insertions(+), 26 deletions(-) diff --git a/alloc/raw/affix.hpp b/alloc/raw/affix.hpp index 1cb0111d..ef80effc 100644 --- a/alloc/raw/affix.hpp +++ b/alloc/raw/affix.hpp @@ -35,8 +35,8 @@ namespace util::alloc::raw { void deallocate (void *ptr, size_t bytes); void deallocate (void *ptr, size_t bytes, size_t align); - void* base (void); - const void* base (void) const; + void* begin (void); + const void* begin (void) const; size_t offset (const void*) const; }; diff --git a/alloc/raw/aligned.hpp b/alloc/raw/aligned.hpp index dcd7e881..cd1d8fd0 100644 --- a/alloc/raw/aligned.hpp +++ b/alloc/raw/aligned.hpp @@ -66,8 +66,8 @@ namespace util::alloc::raw { /////////////////////////////////////////////////////////////////////// - auto base (void) { return m_successor.base (); } - auto base (void) const { return m_successor.base (); } + auto begin (void) { return m_successor.begin (); } + auto begin (void) const { return m_successor.begin (); } //--------------------------------------------------------------------- diff --git a/alloc/raw/dynamic.hpp b/alloc/raw/dynamic.hpp index 931faf29..b7bd5418 100644 --- a/alloc/raw/dynamic.hpp +++ b/alloc/raw/dynamic.hpp @@ -57,8 +57,8 @@ namespace util::alloc::raw { auto deallocate (void *ptr, size_t bytes, size_t alignment) { return m_child->deallocate (ptr, bytes, alignment); } //--------------------------------------------------------------------- - auto base (void) { return m_child->base (); } - auto base (void) const { return m_child->base (); } + auto begin (void) { return m_child->begin (); } + auto begin (void) const { return m_child->begin (); } auto offset (const void *ptr) const { return m_child->offset (ptr); } @@ -93,8 +93,8 @@ namespace util::alloc::raw { virtual void deallocate (void *ptr, size_t bytes) = 0; virtual void deallocate (void *ptr, size_t bytes, size_t alignment) = 0; - virtual void* base (void) = 0; - virtual const void* base (void) const = 0; + virtual void* begin (void) = 0; + virtual const void* begin (void) const = 0; virtual size_t offset (const void*) const = 0; virtual void reset (void) = 0; @@ -133,12 +133,12 @@ namespace util::alloc::raw { { m_target.deallocate (ptr, bytes, alignment); } const void* - base (void) const override - { return m_target.base (); } + begin (void) const override + { return m_target.begin (); } void* - base (void) override - { return m_target.base (); } + begin (void) override + { return m_target.begin (); } size_t offset (const void *ptr) const override diff --git a/alloc/raw/linear.cpp b/alloc/raw/linear.cpp index 65d7097a..30501b0d 100644 --- a/alloc/raw/linear.cpp +++ b/alloc/raw/linear.cpp @@ -77,7 +77,7 @@ linear::deallocate (void *ptr, size_t bytes, size_t alignment) //----------------------------------------------------------------------------- void* -linear::base (void) +linear::begin (void) { return m_begin; } @@ -85,7 +85,7 @@ linear::base (void) //----------------------------------------------------------------------------- const void* -linear::base (void) const +linear::begin (void) const { return m_begin; } diff --git a/alloc/raw/linear.hpp b/alloc/raw/linear.hpp index f5df05cb..82f496da 100644 --- a/alloc/raw/linear.hpp +++ b/alloc/raw/linear.hpp @@ -43,8 +43,14 @@ namespace util::alloc::raw { void deallocate (void *ptr, size_t bytes); void deallocate (void *ptr, size_t bytes, size_t alignment); - void* base (void); - const void* base (void) const; + void* begin (void); + void* end (void); + void* cursor (void); + + const void* begin (void) const; + const void* end (void) const; + const void* cursor (void) const; + size_t offset (const void*) const; void reset (void); diff --git a/alloc/raw/null.cpp b/alloc/raw/null.cpp index 11070fb4..c885f6e9 100644 --- a/alloc/raw/null.cpp +++ b/alloc/raw/null.cpp @@ -68,7 +68,7 @@ null::deallocate (void *ptr, size_t bytes, size_t align) /////////////////////////////////////////////////////////////////////////////// void* -null::base (void) +null::begin (void) { return nullptr; } @@ -76,7 +76,7 @@ null::base (void) //----------------------------------------------------------------------------- const void* -null::base (void) const +null::begin (void) const { return nullptr; } diff --git a/alloc/raw/null.hpp b/alloc/raw/null.hpp index 971a5f48..9003c424 100644 --- a/alloc/raw/null.hpp +++ b/alloc/raw/null.hpp @@ -35,8 +35,8 @@ namespace util::alloc::raw { void deallocate (void *ptr, size_t bytes); void deallocate (void *ptr, size_t bytes, size_t align); - void* base (void); - const void* base (void) const; + void* begin (void); + const void* begin (void) const; size_t offset (const void*) const; void reset (void); diff --git a/alloc/raw/stack.cpp b/alloc/raw/stack.cpp index 7d05ea0b..1f297e2c 100644 --- a/alloc/raw/stack.cpp +++ b/alloc/raw/stack.cpp @@ -113,7 +113,7 @@ stack::deallocate (void *_ptr, size_t bytes, size_t alignment) //----------------------------------------------------------------------------- void* -stack::base (void) +stack::begin (void) { return m_begin; } @@ -121,7 +121,7 @@ stack::base (void) //----------------------------------------------------------------------------- const void* -stack::base (void) const +stack::begin (void) const { return m_begin; } diff --git a/alloc/raw/stack.hpp b/alloc/raw/stack.hpp index c2aac44c..11288ce9 100644 --- a/alloc/raw/stack.hpp +++ b/alloc/raw/stack.hpp @@ -38,8 +38,8 @@ namespace util::alloc::raw { void deallocate (void *ptr, size_t bytes); void deallocate (void *ptr, size_t bytes, size_t alignment); - void* base (void); - const void* base (void) const; + void* begin (void); + const void* begin (void) const; size_t offset (const void*) const; void reset (void); diff --git a/test/alloc/linear.cpp b/test/alloc/linear.cpp index 0e94c68b..7bc06717 100644 --- a/test/alloc/linear.cpp +++ b/test/alloc/linear.cpp @@ -13,7 +13,7 @@ main (void) alignas (std::max_align_t) char memory[BUFFER_SIZE]; util::alloc::raw::linear store (std::begin (memory), std::end (memory)); - tap.expect_eq (store.base (), std::begin (memory), "base pointers match"); + tap.expect_eq (store.begin (), std::begin (memory), "base pointers match"); tap.expect_eq (store.offset (std::begin (memory)), 0u, "base offset is 0"); tap.expect_eq (store.capacity (), BUFFER_SIZE, "bytes capacity matches"); diff --git a/test/alloc/stack.cpp b/test/alloc/stack.cpp index 0c383c5c..a24d750e 100644 --- a/test/alloc/stack.cpp +++ b/test/alloc/stack.cpp @@ -34,7 +34,7 @@ main (void) util::alloc::raw::stack store (memory, memory + BUFFER_AVAILABLE); - tap.expect_eq (store.base (), std::begin (memory), "base pointers match"); + tap.expect_eq (store.begin (), std::begin (memory), "base pointers match"); tap.expect_eq (store.offset (std::begin (memory)), 0u, "base offset is 0"); tap.expect_eq (store.capacity (), BUFFER_AVAILABLE, "bytes capacity matches");