Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Class template new_allocator

boost::container::new_allocator — This class is a reduced STL-compatible allocator that allocates memory using operator new.

Synopsis

// In header: <boost/container/new_allocator.hpp>

template<typename T> 
class new_allocator {
public:
  // types
  typedef                       ;                            
  typedef                     ;                               
  typedef               ;                         
  typedef                     ;                             
  typedef               ;                       
  typedef             ;                             
  typedef          ;                       
  typedef  ;  // A integral constant of type bool with value true. 
  typedef  ;                         // A integral constant of type bool with value true. 

  // member classes/structs/unions
  template<typename T2> 
  struct rebind {
    // types
    typedef new_allocator<  ;
  };

  // construct/copy/destruct
  () ;
  (new_allocator &) ;
  template<typename T2> (new_allocator< ) ;
  new_allocator & (new_allocator &) ;

  // public member functions
   ();
   (, ) ;
   () ;

  // friend functions
   (new_allocator &, new_allocator &) ;
   (new_allocator &, new_allocator &) ;
   (new_allocator &, new_allocator &) ;
};

Description

new_allocator public construct/copy/destruct

  1. () ;

    Default constructor Never throws

  2. (new_allocator &) ;

    Constructor from other new_allocator. Never throws

  3. template<typename T2> (new_allocator< ) ;

    Constructor from related new_allocator. Never throws

  4. new_allocator & (new_allocator &) ;

    Copy assignment operator from other new_allocator. Never throws

new_allocator public member functions

  1.  ( count);

    Allocates memory for an array of count elements. Throws std::bad_alloc if there is no enough memory

  2.  ( ptr, ) ;

    Deallocates previously allocated memory. Never throws

  3.  () ;

    Returns the maximum number of elements that could be allocated. Never throws

new_allocator friend functions

  1.  (new_allocator &, new_allocator &) ;

    Swaps two allocators, does nothing because this new_allocator is stateless

  2.  (new_allocator &, new_allocator &) ;

    An new_allocator always compares to true, as memory allocated with one instance can be deallocated by another instance

  3.  (new_allocator &, new_allocator &) ;

    An new_allocator always compares to false, as memory allocated with one instance can be deallocated by another instance

Specializations


PrevUpHomeNext