Namespaces
Variants

std::allocator<T>:: 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)
(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で削除)

オーバーロードされた operator & が存在する場合でも、 x の実際のアドレスを返します。

パラメータ

x - アドレスを取得するオブジェクト

戻り値

x の実際のアドレス。

欠陥報告

以下の動作変更の欠陥報告書は、以前に公開されたC++規格に対して遡及的に適用されました。

DR 適用対象 公開時の動作 正しい動作
LWG 634
( N2436 )
C++98 戻り値は & x
(これはオーバーロードされた operator & の影響を受ける)
x の実際のアドレスを返す