![]() |
Home | Libraries | People | FAQ | More |
boost::mpi::allocator — Standard Library-compliant allocator for the MPI-2 memory allocation routines.
// In header: <boost/mpi/allocator.hpp> template<typename T> class allocator { public: // types typedef ; // Holds the size of objects. typedef ; // Holds the number of elements between two pointers. typedef ; // A pointer to an object of typeT
. typedef ; // A pointer to a constant object of typeT
. typedef ; // A reference to an object of typeT
. typedef ; // A reference to a constant object of typeT
. typedef ; // The type of memory allocated by this allocator. // member classes/structs/unions // Retrieve the type of an allocator similar to this allocator but for a // different value type. template<typename U> struct rebind { // types typedef allocator< ; }; // construct/copy/destruct (); (allocator &); template<typename U> (allocator< ); ~(); // public member functions () ; () ; (, allocator< = ); (, ); () ; (, ); (); };
This allocator provides a standard C++ interface to the MPI_Alloc_mem
and MPI_Free_mem
routines of MPI-2. It is intended to be used with the containers in the Standard Library (vector
, in particular) in cases where the contents of the container will be directly transmitted via MPI. This allocator is also used internally by the library for character buffers that will be used in the transmission of data.
The allocator
class template only provides MPI memory allocation when the underlying MPI implementation is either MPI-2 compliant or is known to provide MPI_Alloc_mem
and MPI_Free_mem
as extensions. When the MPI memory allocation routines are not available, allocator
is brought in directly from namespace std
, so that standard allocators are used throughout. The macro BOOST_MPI_HAS_MEMORY_ALLOCATION
will be defined when the MPI-2 memory allocation facilities are available.
allocator
public member functions( x) ;
Returns the address of object x
.
( x) ;
Returns the address of object x
.
( n, allocator< = );
Allocate enough memory for n
elements of type T
.
Parameters: |
|
||
Returns: |
a pointer to the newly-allocated memory |
( p, );
Deallocate memory referred to by the pointer p
.
Parameters: |
|
() ;
Returns the maximum number of elements that can be allocated with allocate()
.
( p, val);
Construct a copy of val
at the location referenced by p
.
( p);
Destroy the object referenced by p
.