Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Struct template pointer_traits

boost::intrusive::pointer_traits

Synopsis

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

template<typename Ptr> 
struct pointer_traits {
  // types
  typedef               ;        
  typedef  ;   
  typedef  ;
  typedef       ;         
  typedef  ;      

  // public static functions
   () ;
  template<typename UPtr> 
     () ;
  template<typename UPtr> 
     () ;
  template<typename UPtr> 
     () ;
};

Description

pointer_traits is the implementation of C++11 std::pointer_traits class with some extensions like castings.

pointer_traits supplies a uniform interface to certain attributes of pointer-like types.

Note: When defining a custom family of pointers or references to be used with BI library, make sure the public static conversion functions accessed through the pointer_traits interface (*_cast_from and pointer_to) can properly convert between const and nonconst referred member types without the use of implicit constructor calls. It is suggested these conversions be implemented as function templates, where the template argument is the type of the object being converted from.

pointer_traits public types

  1. typedef ;

    The pointer type queried by this pointer_traits instantiation

  2. typedef ;

    Ptr::element_type if such a type exists; otherwise, T if Ptr is a class template instantiation of the form SomePointer<T, Args>, where Args is zero or more type arguments ; otherwise , the specialization is ill-formed.

  3. typedef ;

    Ptr::difference_type if such a type exists; otherwise, std::ptrdiff_t.

  4. typedef ;

    Ptr::rebind<U> if such a type exists; otherwise, SomePointer<U, Args> if Ptr is a class template instantiation of the form SomePointer<T, Args>, where Args is zero or more type arguments ; otherwise, the instantiation of rebind is ill-formed.

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

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

  5. typedef ;

    Ptr::reference if such a type exists (non-standard extension); otherwise, element_type &

pointer_traits public static functions

  1.  ( r) ;

    Remark: If element_type is (possibly cv-qualified) void, r type is unspecified; otherwise, it is element_type &.

    Returns: A dereferenceable pointer to r obtained by calling Ptr::pointer_to(reference). Non-standard extension: If such function does not exist, returns pointer(addressof(r));

    Note: For non-conforming compilers only the existence of a member function called pointer_to is checked.

  2. template<typename UPtr> 
       ( uptr) ;

    Remark: Non-standard extension.

    Returns: A dereferenceable pointer to r obtained by calling the static template function Ptr::static_cast_from(UPpr/const UPpr &). If such function does not exist, returns pointer_to(static_cast<element_type&>(*uptr))

    Note: For non-conforming compilers only the existence of a member function called static_cast_from is checked.

  3. template<typename UPtr> 
       ( uptr) ;

    Remark: Non-standard extension.

    Returns: A dereferenceable pointer to r obtained by calling the static template function Ptr::const_cast_from<UPtr>(UPpr/const UPpr &). If such function does not exist, returns pointer_to(const_cast<element_type&>(*uptr))

    Note: For non-conforming compilers only the existence of a member function called const_cast_from is checked.

  4. template<typename UPtr> 
       ( uptr) ;

    Remark: Non-standard extension.

    Returns: A dereferenceable pointer to r obtained by calling the static template function Ptr::dynamic_cast_from<UPtr>(UPpr/const UPpr &). If such function does not exist, returns pointer_to(dynamic_cast<element_type>(&*uptr))

    Note: For non-conforming compilers only the existence of a member function called dynamic_cast_from is checked.


PrevUpHomeNext