Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/memory/allocator/address"

From cppreference.com
< cpp‎ | memory‎ | allocator
m (r2.7.3) (Robot: Adding de, es, fr, it, ja, pt, ru, zh)
m (Synopsis: +(1),(2))
 
(10 intermediate revisions by 7 users not shown)
Line 1: Line 1:
 
{{cpp/memory/allocator/title|address}}
 
{{cpp/memory/allocator/title|address}}
 
{{cpp/memory/allocator/navbar}}
 
{{cpp/memory/allocator/navbar}}
{{ddcl list begin}}
+
{{dcl begin}}
{{ddcl list item | 1=
+
{{dcl rev begin|num=1}}
 +
{{dcl|until=c++11|
 
pointer address( reference x ) const;
 
pointer address( reference x ) const;
 
}}
 
}}
{{ddcl list item | 1=
+
{{dcl|since=c++11|deprecated=c++17|removed=c++20|
 +
pointer address( reference x ) const noexcept;
 +
}}
 +
{{dcl rev end}}
 +
{{dcl rev begin|num=2}}
 +
{{dcl|until=c++11|
 
const_pointer address( const_reference x ) const;
 
const_pointer address( const_reference x ) const;
 
}}
 
}}
{{ddcl list end}}
+
{{dcl|since=c++11|deprecated=c++17|removed=c++20|
 +
const_pointer address( const_reference x ) const noexcept;
 +
}}
 +
{{dcl rev end}}
 +
{{dcl end}}
  
Returns the actual address of {{tt|x}} even in presence of overloaded {{c|operator&}}.
+
Returns the actual address of {{c|x}} even in presence of overloaded {{c/core|operator&}}.
  
 
===Parameters===
 
===Parameters===
{{param list begin}}
+
{{par begin}}
{{param list item | x | the object to acquire address of}}
+
{{par|x|the object to acquire address of}}
{{param list end}}
+
{{par end}}
  
 
===Return value===
 
===Return value===
The actual address of {{tt|x}}.
+
The actual address of {{c|x}}.
  
===Exceptions===
+
===Defect reports===
{{noexcept}}
+
{{dr list begin}}
 +
{{dr list item|wg=lwg|dr=634|paper=N2436|std=C++98|before=the return value is {{c|&x}}<br>(which is affected by overloaded {{c/core|operator&}})|after=returns the actual address of {{c|x}}}}
 +
{{dr list end}}
  
[[de:cpp/memory/allocator/address]]
+
{{langlinks|de|es|fr|it|ja|pt|ru|zh}}
[[es:cpp/memory/allocator/address]]
+
[[fr:cpp/memory/allocator/address]]
+
[[it:cpp/memory/allocator/address]]
+
[[ja:cpp/memory/allocator/address]]
+
[[pt:cpp/memory/allocator/address]]
+
[[ru:cpp/memory/allocator/address]]
+
[[zh:cpp/memory/allocator/address]]
+

Latest revision as of 08:28, 22 November 2023

 
 
Dynamic memory management
Uninitialized memory algorithms
Constrained uninitialized memory algorithms
Allocators
Garbage collection support
(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)



 
std::allocator
Member functions
allocator::address
(until C++20)
(until C++20)
(until C++20)
Non-member functions
 
(1)
pointer address( reference x ) const;
(until C++11)
pointer address( reference x ) const noexcept;
(since C++11)
(deprecated in C++17)
(removed in C++20)
(2)
const_pointer address( const_reference x ) const;
(until C++11)
const_pointer address( const_reference x ) const noexcept;
(since C++11)
(deprecated in C++17)
(removed in C++20)

Returns the actual address of x even in presence of overloaded operator&.

[edit] Parameters

x - the object to acquire address of

[edit] Return value

The actual address of x.

[edit] Defect reports

The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

DR Applied to Behavior as published Correct behavior
LWG 634
(N2436)
C++98 the return value is &x
(which is affected by overloaded operator&)
returns the actual address of x