Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/memory/gc/pointer safety"

From cppreference.com
< cpp‎ | memory
m (Shorten template names. Use {{lc}} where appropriate.)
m
 
(7 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 
{{cpp/title|pointer_safety}}
 
{{cpp/title|pointer_safety}}
 
{{cpp/memory/navbar}}
 
{{cpp/memory/navbar}}
{{dcl begin}}
+
{{ddcl | header=memory | since=c++11 | removed=c++23 |
{{dcl header | memory}}
+
{{dcl  | notes={{mark since c++11}} |1=
+
 
enum class pointer_safety {
 
enum class pointer_safety {
 
     relaxed,
 
     relaxed,
Line 10: Line 8:
 
};
 
};
 
}}
 
}}
{{dcl end}}
 
  
The scoped enumeration type {{tt|pointer_safety}} lists the pointer safety modes supported by C++
+
The scoped enumeration type {{tt|pointer_safety}} lists the pointer safety modes supported by C++.
  
 
===Enumeration constants===
 
===Enumeration constants===
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc | pointer_safety::strict | Only safely-derived pointers (pointers to objects allocated with new or subobjects thereof) may be dereferenced or deallocated. Garbage collector may be active.}}
+
{{dsc | {{tt|pointer_safety::strict}} | Only safely-derived pointers (pointers to objects allocated with new or subobjects thereof) may be dereferenced or deallocated. Garbage collector may be active.}}
{{dsc | pointer_safety::preferred | All pointers are considered valid and may be dereferenced or deallocated. A reachability-based leak detector may be active}}
+
{{dsc | {{tt|pointer_safety::preferred}} | All pointers are considered valid and may be dereferenced or deallocated. A reachability-based leak detector may be active.}}
{{dsc | pointer_safety::relaxed | All pointers are considered valid and may be dereferenced or deallocated}}
+
{{dsc | {{tt|pointer_safety::relaxed}} | All pointers are considered valid and may be dereferenced or deallocated.}}
 
{{dsc end}}
 
{{dsc end}}
  
 
===See also===
 
===See also===
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc inc | cpp/memory/gc/dcl list get_pointer_safety}}
+
{{dsc inc | cpp/memory/gc/dsc get_pointer_safety}}
 
{{dsc end}}
 
{{dsc end}}
  
[[de:cpp/memory/gc/pointer safety]]
+
{{langlinks|de|es|fr|it|ja|pt|ru|zh}}
[[es:cpp/memory/gc/pointer safety]]
+
[[fr:cpp/memory/gc/pointer safety]]
+
[[it:cpp/memory/gc/pointer safety]]
+
[[ja:cpp/memory/gc/pointer safety]]
+
[[pt:cpp/memory/gc/pointer safety]]
+
[[ru:cpp/memory/gc/pointer safety]]
+
[[zh:cpp/memory/gc/pointer safety]]
+

Latest revision as of 00:04, 8 June 2021

 
 
Utilities library
General utilities
Relational operators (deprecated in C++20)
 
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)
pointer_safety
(C++11)(until C++23)
(C++11)(until C++23)



 
Defined in header <memory>
enum class pointer_safety {

     relaxed,
     preferred,
     strict

};
(since C++11)
(removed in C++23)

The scoped enumeration type pointer_safety lists the pointer safety modes supported by C++.

[edit] Enumeration constants

pointer_safety::strict Only safely-derived pointers (pointers to objects allocated with new or subobjects thereof) may be dereferenced or deallocated. Garbage collector may be active.
pointer_safety::preferred All pointers are considered valid and may be dereferenced or deallocated. A reachability-based leak detector may be active.
pointer_safety::relaxed All pointers are considered valid and may be dereferenced or deallocated.

[edit] See also

(C++11)(removed in C++23)
returns the current pointer safety model
(function) [edit]