共用方式為


pointer_traits 結構

提供樣板類別 allocator_traits 的物件所需的資訊,以描述具有指標類型 Ptr 的配置器。

template<class Ptr>
    struct pointer_traits;

備註

Ptr 可以屬於型別 Ty * 或具有下列屬性的類別是未經處理的指標。

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
    };

警告

當 C++ 標準指定 rebind 成員做為別名範本時, Visual C++ 實作變更為 struct。

Typedef

Name

說明

typedef T2 difference_type

這個型別的 T2Ptr::difference_type ,如果該型別,否則為 ptrdiff_t。 如果 Ptr 是原始指標,型別為 ptrdiff_t

typedef T1 element_type

這個型別的 T1Ptr::element_type ,如果該型別,否則為 Ty。 如果 Ptr 是原始指標,型別為 Ty

typedef Ptr pointer

型別為 Ptr

Structs

Name

說明

pointer_traits::rebind

嘗試將轉換基底指標型別為指定型別。

方法

Name

說明

pointer_traits::pointer_to 方法

轉換成 Ptr類別物件的選擇性參考。

需求

標頭: <memory>

命名空間: std

請參閱

參考

<memory>

allocator_traits 類別