Changeset View
Changeset View
Standalone View
Standalone View
src/support/allocators/secure.h
Show All 19 Lines | template <typename T> struct secure_allocator : public std::allocator<T> { | ||||
typedef std::allocator<T> base; | typedef std::allocator<T> base; | ||||
typedef typename base::size_type size_type; | typedef typename base::size_type size_type; | ||||
typedef typename base::difference_type difference_type; | typedef typename base::difference_type difference_type; | ||||
typedef typename base::pointer pointer; | typedef typename base::pointer pointer; | ||||
typedef typename base::const_pointer const_pointer; | typedef typename base::const_pointer const_pointer; | ||||
typedef typename base::reference reference; | typedef typename base::reference reference; | ||||
typedef typename base::const_reference const_reference; | typedef typename base::const_reference const_reference; | ||||
typedef typename base::value_type value_type; | typedef typename base::value_type value_type; | ||||
secure_allocator() throw() {} | secure_allocator() noexcept {} | ||||
secure_allocator(const secure_allocator &a) throw() : base(a) {} | secure_allocator(const secure_allocator &a) noexcept : base(a) {} | ||||
template <typename U> | template <typename U> | ||||
secure_allocator(const secure_allocator<U> &a) throw() : base(a) {} | secure_allocator(const secure_allocator<U> &a) noexcept : base(a) {} | ||||
~secure_allocator() throw() {} | ~secure_allocator() noexcept {} | ||||
template <typename _Other> struct rebind { | template <typename _Other> struct rebind { | ||||
typedef secure_allocator<_Other> other; | typedef secure_allocator<_Other> other; | ||||
}; | }; | ||||
T *allocate(std::size_t n, const void *hint = 0) { | T *allocate(std::size_t n, const void *hint = 0) { | ||||
return static_cast<T *>( | return static_cast<T *>( | ||||
LockedPoolManager::Instance().alloc(sizeof(T) * n)); | LockedPoolManager::Instance().alloc(sizeof(T) * n)); | ||||
} | } | ||||
Show All 14 Lines |