Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Class allocator<void>

boost::mpi::allocator<void> — Allocator specialization for void value types.

Synopsis

// In header: <boost/mpi/allocator.hpp>


class allocator<void> {
public:
  // types
  typedef void *         pointer;        
  typedef const void *   const_pointer;  
  typedef void           value_type;     
  typedef std::size_t    size_type;        // Holds the size of objects. 
  typedef std::ptrdiff_t difference_type;  // Holds the number of elements between two pointers. 
  typedef void &         reference;        // A reference to an object of type T. 
  typedef const void &   const_reference;  // A reference to a constant object of type T. 

  // member classes/structs/unions
  
  struct rebind {
    // types
    typedef allocator< U > other;
  };

  // public member functions
  allocator();
  ~allocator();
  pointer address(reference) const;
  pointer allocate(size_type, allocator< void >::const_pointer = 0);
  void deallocate(pointer, size_type);
  size_type max_size() const;
  void construct(pointer, const void &);
  void destroy(pointer);
};

Description

The void specialization of allocator is useful only for rebinding to another, different value type.

allocator public member functions

  1. allocator();

    Default-construct an allocator.

  2. ~allocator();

    Destroy an allocator.

  3. pointer address(reference x) const;

    Returns the address of object x.

  4. pointer allocate(size_type n, allocator< void >::const_pointer = 0);

    Allocate enough memory for n elements of type T.

    Parameters:

    n

    The number of elements for which memory should be allocated.

    Returns:

    a pointer to the newly-allocated memory

  5. void deallocate(pointer p, size_type);

    Deallocate memory referred to by the pointer p.

    Parameters:

    p

    The pointer whose memory should be deallocated. This pointer shall have been returned from the allocate() function and not have already been freed.

  6. size_type max_size() const;

    Returns the maximum number of elements that can be allocated with allocate().

  7. void construct(pointer p, const void & val);

    Construct a copy of val at the location referenced by p.

  8. void destroy(pointer p);

    Destroy the object referenced by p.


PrevUpHomeNext