diff --git a/alib2common/src/allocator/StealthAllocator.hpp b/alib2common/src/allocator/StealthAllocator.hpp index 8d570058ae81173ba8f1e76c2047b831f6455568..7154aa516053c268ff90e113de7a860a68777d63 100644 --- a/alib2common/src/allocator/StealthAllocator.hpp +++ b/alib2common/src/allocator/StealthAllocator.hpp @@ -6,15 +6,29 @@ #define STEALTH_ALLOCATOR_HPP_ #include <memory> +#include <cstddef> #include "../measurements/MeasurementNew.hpp" namespace measurements { template < typename T > -class stealth_allocator : public std::allocator < T > { +class stealth_allocator { public: + using value_type = T; using pointer = T *; - using size_type = size_t; + using const_pointer = const T *; + using reference = T &; + using const_reference = const T &; + using size_type = std::size_t; + using difference_type = std::ptrdiff_t; + + template < typename U > + struct rebind { using other = stealth_allocator < U >; }; + + stealth_allocator ( ) { } + + template < typename U > + stealth_allocator ( const stealth_allocator < U > & ) { } pointer allocate ( size_type n ) { return static_cast < pointer > ( operator new( n * sizeof ( T ), false ) ); @@ -24,11 +38,18 @@ public: operator delete( ptr, false ); } - template < typename U > - struct rebind { using other = stealth_allocator < U >; }; - }; +template < typename T, typename U > +bool operator ==( const stealth_allocator < T > &, const stealth_allocator < U > & ) { + return true; +} + +template < typename T, typename U > +bool operator !=( const stealth_allocator < T > &, const stealth_allocator < U > & ) { + return false; +} + } #endif /* STEALTH_ALLOCATOR_HPP_ */