dune-common  2.3.1
Classes | Public Types | Public Member Functions | List of all members
Dune::MallocAllocator< T > Class Template Reference

Allocators implementation which simply calls malloc/free. More...

#include <dune/common/mallocallocator.hh>

Classes

struct  rebind

Public Types

typedef std::size_t size_type
typedef std::ptrdiff_t difference_type
typedef T * pointer
typedef const T * const_pointer
typedef T & reference
typedef const T & const_reference
typedef T value_type

Public Member Functions

 MallocAllocator () throw ()
 create a new MallocAllocator
template<class U >
 MallocAllocator (const MallocAllocator< U > &) throw ()
 copy construct from an other MallocAllocator, possibly for a different result type
 ~MallocAllocator () throw ()
 cleanup this allocator
pointer address (reference x) const
const_pointer address (const_reference x) const
pointer allocate (size_type n, const void *hint=0)
 allocate n objects of type T
void deallocate (pointer p, size_type n)
 deallocate n objects of type T at address p
size_type max_size () const throw ()
 max size for allocate
void construct (pointer p, const T &val)
 copy-construct an object of type T (i.e. make a placement new on p)
template<typename... _Args>
void construct (pointer p, _Args &&...__args)
void destroy (pointer p)
 destroy an object of type T (i.e. call the destructor)

Detailed Description

template<class T>
class Dune::MallocAllocator< T >

Allocators implementation which simply calls malloc/free.

Member Typedef Documentation

template<class T>
typedef const T* Dune::MallocAllocator< T >::const_pointer
template<class T>
typedef const T& Dune::MallocAllocator< T >::const_reference
template<class T>
typedef std::ptrdiff_t Dune::MallocAllocator< T >::difference_type
template<class T>
typedef T* Dune::MallocAllocator< T >::pointer
template<class T>
typedef T& Dune::MallocAllocator< T >::reference
template<class T>
typedef std::size_t Dune::MallocAllocator< T >::size_type
template<class T>
typedef T Dune::MallocAllocator< T >::value_type

Constructor & Destructor Documentation

template<class T>
Dune::MallocAllocator< T >::MallocAllocator ( ) throw ()
inline

create a new MallocAllocator

template<class T>
template<class U >
Dune::MallocAllocator< T >::MallocAllocator ( const MallocAllocator< U > &  ) throw ()
inline

copy construct from an other MallocAllocator, possibly for a different result type

template<class T>
Dune::MallocAllocator< T >::~MallocAllocator ( ) throw ()
inline

cleanup this allocator

Member Function Documentation

template<class T>
pointer Dune::MallocAllocator< T >::address ( reference  x) const
inline
template<class T>
const_pointer Dune::MallocAllocator< T >::address ( const_reference  x) const
inline
template<class T>
pointer Dune::MallocAllocator< T >::allocate ( size_type  n,
const void *  hint = 0 
)
inline

allocate n objects of type T

References DUNE_UNUSED_PARAMETER, and Dune::MallocAllocator< T >::max_size().

template<class T>
void Dune::MallocAllocator< T >::construct ( pointer  p,
const T &  val 
)
inline

copy-construct an object of type T (i.e. make a placement new on p)

template<class T>
template<typename... _Args>
void Dune::MallocAllocator< T >::construct ( pointer  p,
_Args &&...  __args 
)
inline

construct an object of type T from variadic parameters

Note
works only with newer C++ compilers
template<class T>
void Dune::MallocAllocator< T >::deallocate ( pointer  p,
size_type  n 
)
inline

deallocate n objects of type T at address p

References DUNE_UNUSED_PARAMETER.

template<class T>
void Dune::MallocAllocator< T >::destroy ( pointer  p)
inline

destroy an object of type T (i.e. call the destructor)

template<class T>
size_type Dune::MallocAllocator< T >::max_size ( ) const throw ()
inline

max size for allocate

Referenced by Dune::MallocAllocator< T >::allocate().


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