Namespaces
Variants

std::pointer_traits<Ptr>:: to_address

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::to_address
(C++20) (optional)
定义于头文件 <memory>
static element_type * to_address ( pointer p ) noexcept ;
(C++20 起)
(程序定义特化的可选成员)

构造一个原始指针,该指针引用与其指针式( “花式指针” )参数相同的对象。

此函数若被定义,则是 pointer_to 的逆操作,并作为定制点供 std::to_address 调用。

参数

p - 花式指针/类指针对象

返回值

一个类型为 element_type * 的原始指针,指向与参数 p 相同的内存位置。

参见

[static]
获取指向其参数的可解引用指针
(公开静态成员函数)
(C++20)
从指针式类型获取原始指针
(函数模板)