pointer_traits Struct

Supplies information that is needed by an object of template class allocator_traits to describe an allocator with pointer type Ptr.

template<class Ptr>
    struct pointer_traits;

Remarks

Ptr can be a raw pointer of type Ty * or a class with the following properties.

template<class Ty, class... Rest>
    struct Ptr
    { // describes a pointer type usable by allocators
    typedef Ptr pointer;
    typedef T1 element_type; // optional
    typedef T2 difference_type; // optional
    template<class Other>
        using rebind = typename Ptr<Other, Rest...>; // optional
    
    static pointer pointer_to(element_type& obj); // optional
    };

Warning

While the C++ Standard specifies the rebind member as an alias template, Visual C++ implements rebind as a struct.

Typedefs

Name

Description

typedef T2 difference_type

The type T2 is Ptr::difference_type if that type exists, otherwise ptrdiff_t. If Ptr is a raw pointer, the type is ptrdiff_t.

typedef T1 element_type

The type T1 is Ptr::element_type if that type exists, otherwise Ty. If Ptr is a raw pointer, the type is Ty.

typedef Ptr pointer

The type is Ptr.

Structs

Name

Description

pointer_traits::rebind

Attempts to convert the underlying pointer type to a specified type.

Methods

Name

Description

pointer_traits::pointer_to Method

Converts an arbitrary reference to an object of class Ptr.

Requirements

Header: <memory>

Namespace: std

See Also

Reference

<memory>

allocator_traits Class