다음을 통해 공유


pointer_traits 구조체

포인터 형식 Ptr를 사용하여 할당자를 설명하기 위해 템플릿 클래스 allocator_traits의 개체에 필요한 정보를 제공합니다.

template<class Ptr>
    struct pointer_traits;

설명

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

경고

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

형식 정의

Name

설명

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

형식은 Ptr입니다.

Structs

Name

설명

pointer_traits::rebind

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

메서드

Name

설명

pointer_traits::pointer_to 메서드

Converts an arbitrary reference to an object of class Ptr.

요구 사항

헤더 <memory>

네임스페이스: std

참고 항목

참조

<memory>

allocator_traits 클래스