...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::intrusive::pointer_traits<T *>
// 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 std::size_t size_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) noexcept; template<typename U> static pointer static_cast_from(U *) noexcept; template<typename U> static pointer const_cast_from(U *) noexcept; template<typename U> static pointer dynamic_cast_from(U *) noexcept; };
Specialization of pointer_traits for raw pointers
pointer_traits
public static functionsstatic pointer pointer_to(reference r) noexcept;
Returns: addressof(r)
template<typename U> static pointer static_cast_from(U * uptr) noexcept;
Returns: static_cast<pointer>(uptr)
template<typename U> static pointer const_cast_from(U * uptr) noexcept;
Returns: const_cast<pointer>(uptr)
template<typename U> static pointer dynamic_cast_from(U * uptr) noexcept;
Returns: dynamic_cast<pointer>(uptr)