Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.
PrevUpHomeNext

Class new_allocator<void>

boost::container::new_allocator<void> — Specialization of new_allocator for void types.

Synopsis

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


class new_allocator<void> {
public:
  // types
  typedef void                   value_type;                            
  typedef void *                 pointer;                               
  typedef const void *           const_pointer;                         
  typedef implementation_defined propagate_on_container_move_assignment;  // A integral constant of type bool with value true. 
  typedef implementation_defined is_always_equal;                         // A integral constant of type bool with value true. 

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

  // construct/copy/destruct
  new_allocator() noexcept;
  new_allocator(const new_allocator &) noexcept;
  template<typename T2> new_allocator(const new_allocator< T2 > &) noexcept;
  new_allocator & operator=(const new_allocator &) noexcept;

  // friend functions
  friend void swap(new_allocator &, new_allocator &) noexcept;
  friend bool operator==(const new_allocator &, const new_allocator &) noexcept;
  friend bool operator!=(const new_allocator &, const new_allocator &) noexcept;
};

Description

new_allocator public construct/copy/destruct

  1. new_allocator() noexcept;

    Default constructor Never throws

  2. new_allocator(const new_allocator &) noexcept;

    Constructor from other new_allocator. Never throws

  3. template<typename T2> new_allocator(const new_allocator< T2 > &) noexcept;

    Constructor from related new_allocator. Never throws

  4. new_allocator & operator=(const new_allocator &) noexcept;

    Copy assignment operator from other new_allocator. Never throws

new_allocator friend functions

  1. friend void swap(new_allocator &, new_allocator &) noexcept;

    Swaps two allocators, does nothing because this new_allocator is stateless

  2. friend bool operator==(const new_allocator &, const new_allocator &) noexcept;

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

  3. friend bool operator!=(const new_allocator &, const new_allocator &) noexcept;

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


PrevUpHomeNext