Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Struct template allocator_traits

boost::container::allocator_traits

Synopsis

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

template<typename Allocator> 
struct allocator_traits {
  // types
  typedef Allocator                             allocator_type;                        
  typedef allocator_type::value_type            value_type;                            
  typedef unspecified                           pointer;                               
  typedef see_documentation                     const_pointer;                         
  typedef see_documentation                     reference;                             
  typedef see_documentation                     const_reference;                       
  typedef see_documentation                     void_pointer;                          
  typedef see_documentation                     const_void_pointer;                    
  typedef see_documentation                     difference_type;                       
  typedef see_documentation                     size_type;                             
  typedef see_documentation                     propagate_on_container_copy_assignment;
  typedef see_documentation                     propagate_on_container_move_assignment;
  typedef see_documentation                     propagate_on_container_swap;           
  typedef see_documentation                     is_always_equal;                       
  typedef see_documentation                     is_partially_propagable;               
  typedef see_documentation                     rebind_alloc;                          
  typedef allocator_traits< rebind_alloc< T > > rebind_traits;                         

  // member classes/structs/unions
  template<typename T> 
  struct portable_rebind_alloc {
    // types
    typedef see_documentation type;
  };

  // public static functions
  static pointer allocate(Allocator &, size_type);
  static void deallocate(Allocator &, pointer, size_type);
  static pointer allocate(Allocator &, size_type, const_void_pointer);
  template<typename T> static void destroy(Allocator &, T *) noexcept;
  static size_type max_size(const Allocator &) noexcept;
  static Allocator select_on_container_copy_construction(const Allocator &);
  template<typename T, class... Args> 
    static void construct(Allocator &, T *, Args &&...);
  static bool storage_is_unpropagable(const Allocator &, pointer) noexcept;
  static bool equal(const Allocator &, const Allocator &) noexcept;
};

Description

The class template allocator_traits supplies a uniform interface to all allocator types. This class is a C++03-compatible implementation of std::allocator_traits

allocator_traits public types

  1. typedef unspecified pointer;

    Allocator::pointer if such a type exists; otherwise, value_type*

  2. typedef see_documentation const_pointer;

    Allocator::const_pointer if such a type exists ; otherwise, pointer_traits<pointer>::rebind<const

  3. typedef see_documentation reference;

    Non-standard extension Allocator::reference if such a type exists; otherwise, value_type&

  4. typedef see_documentation const_reference;

    Non-standard extension Allocator::const_reference if such a type exists ; otherwise, const value_type&

  5. typedef see_documentation void_pointer;

    Allocator::void_pointer if such a type exists ; otherwise, pointer_traits<pointer>::rebind<void>.

  6. typedef see_documentation const_void_pointer;

    Allocator::const_void_pointer if such a type exists ; otherwis e, pointer_traits<pointer>::rebind<const

  7. typedef see_documentation difference_type;

    Allocator::difference_type if such a type exists ; otherwise, pointer_traits<pointer>::difference_type.

  8. typedef see_documentation size_type;

    Allocator::size_type if such a type exists ; otherwise, make_unsigned<difference_type>::type

  9. typedef see_documentation propagate_on_container_copy_assignment;

    Allocator::propagate_on_container_copy_assignment if such a type exists, otherwise a type with an internal constant static boolean member value == false.

  10. typedef see_documentation propagate_on_container_move_assignment;

    Allocator::propagate_on_container_move_assignment if such a type exists, otherwise a type with an internal constant static boolean member value == false.

  11. typedef see_documentation propagate_on_container_swap;

    Allocator::propagate_on_container_swap if such a type exists, otherwise a type with an internal constant static boolean member value == false.

  12. typedef see_documentation is_always_equal;

    Allocator::is_always_equal if such a type exists, otherwise a type with an internal constant static boolean member value == is_empty<Allocator>::value

  13. typedef see_documentation is_partially_propagable;

    Allocator::is_partially_propagable if such a type exists, otherwise a type with an internal constant static boolean member value == false Note: Non-standard extension used to implement small_vector_allocator.

  14. typedef see_documentation rebind_alloc;

    Defines an allocator: Allocator::rebind<T>::other if such a type exists; otherwise, Allocator<T, Args> if Allocator is a class template instantiation of the form Allocator<U, Args>, where Args is zero or more type arguments ; otherwise, the instantiation of rebind_alloc is ill-formed.

    In C++03 compilers rebind_alloc is a struct derived from an allocator deduced by previously detailed rules.

  15. typedef allocator_traits< rebind_alloc< T > > rebind_traits;

    In C++03 compilers rebind_traits is a struct derived from allocator_traits<OtherAlloc>, where OtherAlloc is the allocator deduced by rules explained in rebind_alloc.

allocator_traits public static functions

  1. static pointer allocate(Allocator & a, size_type n);

    Returns: a.allocate(n)

  2. static void deallocate(Allocator & a, pointer p, size_type n);

    Returns: a.deallocate(p, n)

    Throws: Nothing

  3. static pointer allocate(Allocator & a, size_type n, const_void_pointer p);

    Effects: calls a.allocate(n, p) if that call is well-formed; otherwise, invokes a.allocate(n)

  4. template<typename T> static void destroy(Allocator & a, T * p) noexcept;

    Effects: calls a.destroy(p) if that call is well-formed; otherwise, invokes p->~T().

  5. static size_type max_size(const Allocator & a) noexcept;

    Returns: a.max_size() if that expression is well-formed; otherwise, numeric_limits<size_type>::max().

  6. static Allocator select_on_container_copy_construction(const Allocator & a);

    Returns: a.select_on_container_copy_construction() if that expression is well-formed; otherwise, a.

  7. template<typename T, class... Args> 
      static void construct(Allocator & a, T * p, Args &&... args);

    Effects: calls a.construct(p, std::forward<Args>(args)...) if that call is well-formed; otherwise, invokes ::new (static_cast<void*>(p)) T(std::forward<Args>(args)...)

  8. static bool storage_is_unpropagable(const Allocator & a, pointer p) noexcept;

    Returns: a.storage_is_unpropagable(p) if is_partially_propagable::value is true; otherwise, false.

  9. static bool equal(const Allocator & a, const Allocator & b) noexcept;

    Returns: true if is_always_equal::value == true, otherwise, a == b.


PrevUpHomeNext