tbb::zero_allocator< T, Allocator > Class Template Reference
Memory Allocation

Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5. More...

`#include <tbb_allocator.h>`

Inheritance diagram for tbb::zero_allocator< T, Allocator >:
Collaboration diagram for tbb::zero_allocator< T, Allocator >:

## Classes

struct | rebind

## Public Types

typedef Allocator< T > | base_allocator_type
typedef base_allocator_type::value_type | value_type
typedef base_allocator_type::pointer | pointer
typedef base_allocator_type::const_pointer | const_pointer
typedef base_allocator_type::reference | reference
typedef base_allocator_type::const_reference | const_reference
typedef base_allocator_type::size_type | size_type
typedef base_allocator_type::difference_type | difference_type

## Public Member Functions

| 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)

## Detailed Description

### template<typename T, template< typename X > class Allocator = tbb_allocator>
class tbb::zero_allocator< T, Allocator >

Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5.

The class is an adapter over an actual allocator that fills the allocation using memset function with template argument C as the value. The members are ordered the same way they are in section 20.4.1 of the ISO C++ standard.

Definition at line 151 of file tbb_allocator.h.

## Member Typedef Documentation

## base_allocator_type

template<typename T, template< typename X > class Allocator = tbb_allocator>

typedef Allocator<T> tbb::zero_allocator< T, Allocator >::base_allocator_type

Definition at line 154 of file tbb_allocator.h.

## const_pointer

template<typename T, template< typename X > class Allocator = tbb_allocator>

typedef base_allocator_type::const_pointer tbb::zero_allocator< T, Allocator >::const_pointer

Definition at line 157 of file tbb_allocator.h.

## const_reference

template<typename T, template< typename X > class Allocator = tbb_allocator>

typedef base_allocator_type::const_reference tbb::zero_allocator< T, Allocator >::const_reference

Definition at line 159 of file tbb_allocator.h.

## difference_type

template<typename T, template< typename X > class Allocator = tbb_allocator>

typedef base_allocator_type::difference_type tbb::zero_allocator< T, Allocator >::difference_type

Definition at line 161 of file tbb_allocator.h.

## pointer

template<typename T, template< typename X > class Allocator = tbb_allocator>

typedef base_allocator_type::pointer tbb::zero_allocator< T, Allocator >::pointer

Definition at line 156 of file tbb_allocator.h.

## reference

template<typename T, template< typename X > class Allocator = tbb_allocator>

typedef base_allocator_type::reference tbb::zero_allocator< T, Allocator >::reference

Definition at line 158 of file tbb_allocator.h.

## size_type

template<typename T, template< typename X > class Allocator = tbb_allocator>

typedef base_allocator_type::size_type tbb::zero_allocator< T, Allocator >::size_type

Definition at line 160 of file tbb_allocator.h.

## value_type

template<typename T, template< typename X > class Allocator = tbb_allocator>

typedef base_allocator_type::value_type tbb::zero_allocator< T, Allocator >::value_type

Definition at line 155 of file tbb_allocator.h.

## Constructor & Destructor Documentation

## zero_allocator() [1/3]

template<typename T, template< typename X > class Allocator = tbb_allocator>

tbb::zero_allocator< T, Allocator >::zero_allocator | ( |  | ) |
throw | ( |
| ) |  |

inline

Definition at line 166 of file tbb_allocator.h.

{ }

## zero_allocator() [2/3]

template<typename T, template< typename X > class Allocator = tbb_allocator>

tbb::zero_allocator< T, Allocator >::zero_allocator | ( | const zero_allocator< T, Allocator > & | a | ) |
throw | ( |
| ) |  |

inline

Definition at line 167 of file tbb_allocator.h.

: base_allocator_type( a ) { }

## zero_allocator() [3/3]

template<typename T, template< typename X > class Allocator = tbb_allocator>
template<typename U >

tbb::zero_allocator< T, Allocator >::zero_allocator | ( | const zero_allocator< U > & | a | ) |
throw | ( |
| ) |  |

inline

Definition at line 169 of file tbb_allocator.h.

: base_allocator_type( Allocator<U>( a ) ) { }

## Member Function Documentation

## allocate()

template<typename T, template< typename X > class Allocator = tbb_allocator>

pointer tbb::zero_allocator< T, Allocator >::allocate | ( | const size_type | n,
|  | const void * | hint = `0`
| ) |  |

inline

Definition at line 171 of file tbb_allocator.h.

{
pointer ptr = base_allocator_type::allocate( n, hint );
std::memset( static_cast<void*>(ptr), 0, n * sizeof(value_type) );
return ptr;
}

The documentation for this class was generated from the following file:

- tbb_allocator.h

tbb::zero_allocator::base_allocator_type
Allocator< T > base_allocator_type
Definition: tbb_allocator.h:154
tbb::zero_allocator::value_type
base_allocator_type::value_type value_type
Definition: tbb_allocator.h:155
tbb::zero_allocator::pointer
base_allocator_type::pointer pointer
Definition: tbb_allocator.h:156

Copyright © 2005-2020 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.