diff --git a/alloc/raw/linear.hpp b/alloc/raw/linear.hpp index 5d73cb96..da11fa8e 100644 --- a/alloc/raw/linear.hpp +++ b/alloc/raw/linear.hpp @@ -82,6 +82,16 @@ namespace util::alloc::raw { size_t offset (const void*) const; + template + size_t + offset (ValueT const *ptr) const + { + CHECK_MOD (reinterpret_cast (ptr), sizeof (ValueT)); + CHECK_MOD (reinterpret_cast (data ()), sizeof (ValueT)); + + return ptr - util::cast::alignment (data ()); + } + template size_t offset (util::view ptr) const