#ifndef SALLOC_H #define SALLOC_H // a C++ allocator trait class based on the slice allocator template struct slice_allocator { typedef Tp value_type; slice_allocator () noexcept { } template slice_allocator (const slice_allocator &) noexcept { } ~slice_allocator () noexcept { } template bool operator == (const slice_allocator &) noexcept { return true ; } template bool operator != (const slice_allocator &) noexcept { return false; } Tp *allocate (std::size_t n) { return (Tp *)g_slice_alloc (n * sizeof (Tp)); } void deallocate (Tp *p, std::size_t n) noexcept { g_slice_free1 (n * sizeof (Tp), p); } }; #endif