zero_allocator テンプレート・クラス

概要

ゼロに設定されたメモリーを返すアロケーターのテンプレート・クラス。

構文

template <typename T, 
          template<typename U> class Alloc = tbb_allocator> 
class zero_allocator: public Alloc<T>;

ヘッダー

#include "tbb/tbb_allocator.h"

説明

zero_allocator は、ゼロに設定されたメモリーを割り当てます。zero_allocator<T,A> は、Allocator コンセプトをモデル化するすべての A クラスを具体化できます。A のデフォルトは tbb_allocator です。zero_allocator は割り当てリクエストを A に送り、リターンする前に割り当てをゼロに設定します。

メンバー

namespace tbb {
    template <typename T, template<typename U> class Alloc = tbb_allocator>
    class zero_allocator : public Alloc<T> {
    public:
        typedef Alloc<T> base_allocator_type;
        typedef typename base_allocator_type::value_type 
                                              value_type;
        typedef typename base_allocator_type::pointer pointer;
        typedef typename base_allocator_type::const_pointer 
                                              const_pointer;
        typedef typename base_allocator_type::reference 
 reference;
        typedef typename base_allocator_type::const_reference 
                                              const_reference;
        typedef typename base_allocator_type::size_type 
                                              size_type;
        typedef typename base_allocator_type::difference_type 
                                              difference_type;
        template<typename U> struct rebind {
            typedef zero_allocator<U, Alloc> other;
        };

        zero_allocator() throw() { }
        zero_allocator(const zero_allocator &a) throw();
        template<typename U>
        zero_allocator(const zero_allocator<U> &a) throw(); 

        pointer allocate(const size_type n, const void* hint=0);
    };
}