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

Struct template pointer_traits<T *>

boost::intrusive::pointer_traits<T *>

Synopsis

// In header: <boost/intrusive/pointer_traits.hpp>

template<typename T> 
struct pointer_traits<T *> {
  // types
  typedef T              element_type;   
  typedef T *            pointer;        
  typedef std::ptrdiff_t difference_type;
  typedef T &            reference;      
  typedef U *            rebind;         

  // member classes/structs/unions
  template<typename U> 
  struct rebind_pointer {
    // types
    typedef U * type;
  };

  // public static functions
  static pointer pointer_to(reference);
  template<typename U> static pointer static_cast_from(U *);
  template<typename U> static pointer const_cast_from(U *);
  template<typename U> static pointer dynamic_cast_from(U *);
};

Description

Specialization of pointer_traits for raw pointers

pointer_traits public types

  1. typedef U * rebind;

    U *

    For portable code for C++03 and C++11,

    typename rebind_pointer<U>::type

    shall be used instead of rebind<underline> to obtain a pointer to U. </underline>

pointer_traits public static functions

  1. static pointer pointer_to(reference r);

    Returns: addressof(r)

  2. template<typename U> static pointer static_cast_from(U * uptr);

    Returns: static_cast<pointer>(uptr)

  3. template<typename U> static pointer const_cast_from(U * uptr);

    Returns: const_cast<pointer>(uptr)

  4. template<typename U> static pointer dynamic_cast_from(U * uptr);

    Returns: dynamic_cast<pointer>(uptr)


PrevUpHomeNext