次の方法で共有


pointer_traits 構造体

ポインター型 Ptrを持つアロケーターを説明するテンプレート クラスのオブジェクト allocator_traits に必要な情報を提供します。

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
    };
Caution メモ注意

C++ 標準でエイリアスのテンプレートとして rebind のメンバーを指定できますが、Visual C++ は structとして再を実装します。

JJ190031.collapse_all(ja-jp,VS.110).gifTypedef

名前

説明

typedef T2 difference_type

その型である場合 T2 型は Ptr::difference_type、それ ptrdiff_tです。Ptr は、ポインターの場合、型は ptrdiff_tです。

typedef T1 element_type

その型である場合 T1 型は Ptr::element_type、それ Tyです。Ptr は、ポインターの場合、型は Tyです。

typedef Ptr pointer

型は Ptr です。

JJ190031.collapse_all(ja-jp,VS.110).gif構造体

名前

説明

pointer_traits::rebind

指定した型の基になる型のポインターに変換します。

JJ190031.collapse_all(ja-jp,VS.110).gifメソッド

名前

説明

pointer_traits::pointer_to メソッド

クラス Ptr任意のオブジェクトへの参照を変換します。

必要条件

ヘッダー : <memory>

名前空間: std

参照

関連項目

<memory>

allocator_traits クラス