std::pointer_traits::pointer_to
STD::指针[医]特征::指针[医]到
Defined in header | | |
---|---|---|
static pointer pointer_to( element_type& r | (1) | (since C++11) (member of pointer_traits<Ptr> specialization) |
static pointer pointer_to( element_type& r | (2) | (since C++11) (member of pointer_traits<T*> specialization) |
为其参数构造可取消引用的指针或类似指针的对象%28“花式指针”%29。
1%29这个函数的版本在非专门化。std::pointer_traits
模板只需调用Ptr::pointer_to(r)
,如果PTR不提供静态成员函数pointer_to
,此函数的实例化是编译时错误。
2%29该函数在专门化中的版本std::pointer_traits
对于指针类型,返回std::addressof
(r)
参数
r | - | reference to an object of type element_type&, except if element_type is void, in which case the type of r is unspecified |
---|
返回值
指向r,类型指针的[医]性状<>:指针。
例外
1%29未指定的%28通常与Ptr::pointer_to
%29
2%29
noexcept
规格:
noexcept
注记
大Boost库版本函数的返回pointer(
std::addressof
(r))
如果PTR::指针[医]不存在。
另见
addressof (C++11) | obtains actual address of an object, even if the & operator is overloaded (function template) |
---|---|
address (deprecated in C++17) | obtains the address of an object, even if operator& is overloaded (public member function of std::allocator) |
© cppreference.com
在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。