From Jason Turner

[mem.res.class]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpuo_wx19g/{from.md → to.md} +12 -4
tmp/tmpuo_wx19g/{from.md → to.md} RENAMED
@@ -1,7 +1,9 @@
1
  ### Class `memory_resource` <a id="mem.res.class">[[mem.res.class]]</a>
2
 
 
 
3
  The `memory_resource` class is an abstract interface to an unbounded set
4
  of classes encapsulating memory resources.
5
 
6
  ``` cpp
7
  namespace std::pmr {
@@ -39,11 +41,17 @@ namespace std::pmr {
39
 
40
  ``` cpp
41
  [[nodiscard]] void* allocate(size_t bytes, size_t alignment = max_align);
42
  ```
43
 
44
- *Effects:* Equivalent to: `return do_allocate(bytes, alignment);`
 
 
 
 
 
 
45
 
46
  ``` cpp
47
  void deallocate(void* p, size_t bytes, size_t alignment = max_align);
48
  ```
49
 
@@ -90,13 +98,13 @@ virtual bool do_is_equal(const memory_resource& other) const noexcept = 0;
90
 
91
  *Returns:* A derived class shall implement this function to return
92
  `true` if memory allocated from `this` can be deallocated from `other`
93
  and vice-versa, otherwise `false`.
94
 
95
- [*Note 1*: The most-derived type of `other` might not match the type of
96
- `this`. For a derived class `D`, an implementation of this function
97
- could immediately return `false` if
98
  `dynamic_cast<const D*>(&other) == nullptr`. — *end note*]
99
 
100
  #### Equality <a id="mem.res.eq">[[mem.res.eq]]</a>
101
 
102
  ``` cpp
 
1
  ### Class `memory_resource` <a id="mem.res.class">[[mem.res.class]]</a>
2
 
3
+ #### General <a id="mem.res.class.general">[[mem.res.class.general]]</a>
4
+
5
  The `memory_resource` class is an abstract interface to an unbounded set
6
  of classes encapsulating memory resources.
7
 
8
  ``` cpp
9
  namespace std::pmr {
 
41
 
42
  ``` cpp
43
  [[nodiscard]] void* allocate(size_t bytes, size_t alignment = max_align);
44
  ```
45
 
46
+ *Effects:* Allocates storage by calling `do_allocate(bytes, alignment)`
47
+ and implicitly creates objects within the allocated region of storage.
48
+
49
+ *Returns:* A pointer to a suitable created object [[intro.object]] in
50
+ the allocated region of storage.
51
+
52
+ *Throws:* What and when the call to `do_allocate` throws.
53
 
54
  ``` cpp
55
  void deallocate(void* p, size_t bytes, size_t alignment = max_align);
56
  ```
57
 
 
98
 
99
  *Returns:* A derived class shall implement this function to return
100
  `true` if memory allocated from `this` can be deallocated from `other`
101
  and vice-versa, otherwise `false`.
102
 
103
+ [*Note 1*: It is possible that the most-derived type of `other` does
104
+ not match the type of `this`. For a derived class `D`, an implementation
105
+ of this function can immediately return `false` if
106
  `dynamic_cast<const D*>(&other) == nullptr`. — *end note*]
107
 
108
  #### Equality <a id="mem.res.eq">[[mem.res.eq]]</a>
109
 
110
  ``` cpp