std::allocator<T>::address
来自cppreference.com
<tbody>
</tbody>
<tbody class="t-dcl-rev t-dcl-rev-num ">
</tbody><tbody>
</tbody>
<tbody class="t-dcl-rev t-dcl-rev-num ">
</tbody><tbody>
</tbody>
| (1) | ||
pointer address( reference x ) const; |
(C++11 前) | |
pointer address( reference x ) const noexcept; |
(C++11 起) (C++17 弃用) (C++20 移除) |
|
| (2) | ||
const_pointer address( const_reference x ) const; |
(C++11 前) | |
const_pointer address( const_reference x ) const noexcept; |
(C++11 起) (C++17 弃用) (C++20 移除) |
|
返回 x 的实际地址,即使存在重载的 operator& 也是如此。
参数
| x | - | 要获取地址的对象 |
返回值
x 的实际地址。
缺陷报告
下列更改行为的缺陷报告追溯地应用于以前出版的 C++ 标准。
| 缺陷报告 | 应用于 | 出版时的行为 | 正确行为 |
|---|---|---|---|
| LWG 634 (N2436) |
C++98 | 返回值是 &x(会受重载的 operator& 影响)
|
返回 x 的实际地址
|