From Jason Turner

[mem.res.global]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpys1foimb/{from.md → to.md} +50 -0
tmp/tmpys1foimb/{from.md → to.md} RENAMED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Access to program-wide `memory_resource` objects <a id="mem.res.global">[[mem.res.global]]</a>
2
+
3
+ ``` cpp
4
+ memory_resource* new_delete_resource() noexcept;
5
+ ```
6
+
7
+ *Returns:* A pointer to a static-duration object of a type derived from
8
+ `memory_resource` that can serve as a resource for allocating memory
9
+ using `::operator new` and `::operator delete`. The same value is
10
+ returned every time this function is called. For a return value `p` and
11
+ a memory resource `r`, `p->is_equal(r)` returns `&r == p`.
12
+
13
+ ``` cpp
14
+ memory_resource* null_memory_resource() noexcept;
15
+ ```
16
+
17
+ *Returns:* A pointer to a static-duration object of a type derived from
18
+ `memory_resource` for which `allocate()` always throws `bad_alloc` and
19
+ for which `deallocate()` has no effect. The same value is returned every
20
+ time this function is called. For a return value `p` and a memory
21
+ resource `r`, `p->is_equal(r)` returns `&r == p`.
22
+
23
+ The *default memory resource pointer* is a pointer to a memory resource
24
+ that is used by certain facilities when an explicit memory resource is
25
+ not supplied through the interface. Its initial value is the return
26
+ value of `new_delete_resource()`.
27
+
28
+ ``` cpp
29
+ memory_resource* set_default_resource(memory_resource* r) noexcept;
30
+ ```
31
+
32
+ *Effects:* If `r` is non-null, sets the value of the default memory
33
+ resource pointer to `r`, otherwise sets the default memory resource
34
+ pointer to `new_delete_resource()`.
35
+
36
+ *Postconditions:* `get_default_resource() == r`.
37
+
38
+ *Returns:* The previous value of the default memory resource pointer.
39
+
40
+ *Remarks:* Calling the `set_default_resource` and `get_default_resource`
41
+ functions shall not incur a data race. A call to the
42
+ `set_default_resource` function shall synchronize with subsequent calls
43
+ to the `set_default_resource` and `get_default_resource` functions.
44
+
45
+ ``` cpp
46
+ memory_resource* get_default_resource() noexcept;
47
+ ```
48
+
49
+ *Returns:* The current value of the default memory resource pointer.
50
+