diff --git a/include/sparrow/allocator.hpp b/include/sparrow/allocator.hpp index 24a6319e..bde491db 100644 --- a/include/sparrow/allocator.hpp +++ b/include/sparrow/allocator.hpp @@ -40,6 +40,11 @@ namespace sparrow { alloc.deallocate(p, n) } -> std::same_as; }; + /* + * When the allocator A with value_type T satisfies this concept, any_allocator + * can store it as a value in a small buffer instead of having to type-erased it + * (Small Buffer Optimization). + */ template concept can_any_allocator_sbo = allocator && (std::same_as> || std::same_as>); @@ -116,7 +121,7 @@ namespace sparrow { if (std::type_index(typeid(*this)) == std::type_index(typeid(rhs))) { - return m_alloc == static_cast*>(&rhs)->m_alloc; + return m_alloc == static_cast*>(std::addressof(rhs))->m_alloc; } return false; }