std::pointer_traits<Ptr>:: pointer_to
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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" )指向其参数。
pointer_to
,则此函数的实例化将导致编译时错误。
目录 |
参数
| r | - |
对
element_type
&
类型对象的引用,除非 element_type 为
void
,此时
r
的类型未指定
|
返回值
一个可解引用的指向 r 的指针,其类型为 pointer_traits <> :: pointer 。
异常
注释
该函数的 Boost.Intrusive库版本 在 Ptr :: pointer_to 不存在时返回 pointer ( std:: addressof ( r ) ) 。
参见
|
(C++11)
|
获取对象的实际地址,即使
&
运算符已被重载
(函数模板) |
|
(until C++20)
|
获取对象地址,即使
operator
&
已被重载
(
std::allocator<T>
的公开成员函数)
|
|
[static]
(C++20)
(optional)
|
从 fancy pointer 获取原始指针(
pointer_to
的逆操作)
(公开静态成员函数) |
|
(C++20)
|
从类指针类型获取原始指针
(函数模板) |