std::allocator<T>:: address
From cppreference.net
C++
Memory management library
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
std::allocator
| Member functions | ||||
|
allocator::address
(until C++20)
|
||||
|
(C++23)
|
||||
|
(until C++20)
|
||||
|
(until C++20)
|
||||
|
(until C++20)
|
||||
| Non-member functions | ||||
|
(until C++20)
|
| (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 的实际地址 |