Namespaces
Variants

std::pointer_traits<Ptr>:: pointer_to

From cppreference.net
Memory management library
( exposition only* )
Allocators
Uninitialized memory algorithms
Constrained uninitialized memory algorithms
Memory resources
Uninitialized storage (until C++20)
( until C++20* )
( until C++20* )
( until C++20* )

Garbage collector support (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
std::pointer_traits
Member functions
pointer_traits::pointer_to
(C++11)
(C++20) (optional)
헤더에 정의됨 <memory>
static pointer
pointer_to ( element_type & r ) ;
(1) (C++11부터)
( pointer_traits<Ptr> 특수화의 멤버)
(2)
static pointer
pointer_to ( element_type & r ) noexcept ;
(C++11부터)
(C++20까지)
( pointer_traits<T*> 특수화의 멤버)
static constexpr pointer
pointer_to ( element_type & r ) noexcept ;
(C++20부터)
( pointer_traits<T*> 특수화의 멤버)

인자에 대한 역참조 가능한 포인터 또는 포인터와 유사한 객체( "fancy pointer" )를 생성합니다.

1) 비특수화된 std::pointer_traits 템플릿 내 이 함수의 버전은 단순히 Ptr :: pointer_to ( r ) 를 호출하며, Ptr이 정적 멤버 함수 pointer_to 를 제공하지 않을 경우 이 함수의 인스턴스화는 컴파일 시간 오류가 됩니다.
2) 이 함수의 특수화 버전인 std::pointer_traits 의 포인터 타입에 대해서는 std:: addressof ( r ) 를 반환합니다.

목차

매개변수

r - element_type & 타입의 객체에 대한 참조, 단 void 인 경우에는 r 의 타입이 지정되지 않음

반환값

역참조 가능한 포인터로, r 에 대한 pointer_traits <> :: pointer 타입입니다.

예외

1) 지정되지 않음 (일반적으로 Ptr :: pointer_to 와 동일함).

참고 사항

이 함수의 Boost.Intrusive 라이브러리 버전 pointer ( std:: addressof ( r ) ) 을 반환합니다, 만약 Ptr :: pointer_to 가 존재하지 않는 경우.

참고 항목

(C++11)
객체의 실제 주소를 획득합니다. & 연산자가 오버로드된 경우에도 동작합니다.
(함수 템플릿)
(until C++20)
객체의 주소를 획득합니다. operator & 가 오버로드된 경우에도 동작합니다.
( std::allocator<T> 의 public 멤버 함수)
[static] (C++20) (optional)
팬시 포인터(fancy pointer)로부터 원시 포인터(raw pointer)를 획득합니다 ( pointer_to 의 역함수)
(public static 멤버 함수)
(C++20)
포인터와 유사한 타입으로부터 원시 포인터를 획득합니다
(함수 템플릿)