From Jason Turner

[mem.res.class]

Diff to HTML by rtfpessoa

tmp/tmpry9yjkn6/{from.md → to.md} RENAMED
@@ -15,11 +15,11 @@ namespace std::pmr {
15
  memory_resource(const memory_resource&) = default;
16
  virtual ~memory_resource();
17
 
18
  memory_resource& operator=(const memory_resource&) = default;
19
 
20
- [[nodiscard]] void* allocate(size_t bytes, size_t alignment = max_align);
21
  void deallocate(void* p, size_t bytes, size_t alignment = max_align);
22
 
23
  bool is_equal(const memory_resource& other) const noexcept;
24
 
25
  private:
@@ -38,11 +38,11 @@ namespace std::pmr {
38
  ```
39
 
40
  *Effects:* Destroys this `memory_resource`.
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
 
@@ -95,16 +95,16 @@ allocated storage.
95
  ``` cpp
96
  virtual bool do_is_equal(const memory_resource& other) const noexcept = 0;
97
  ```
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
 
15
  memory_resource(const memory_resource&) = default;
16
  virtual ~memory_resource();
17
 
18
  memory_resource& operator=(const memory_resource&) = default;
19
 
20
+ void* allocate(size_t bytes, size_t alignment = max_align);
21
  void deallocate(void* p, size_t bytes, size_t alignment = max_align);
22
 
23
  bool is_equal(const memory_resource& other) const noexcept;
24
 
25
  private:
 
38
  ```
39
 
40
  *Effects:* Destroys this `memory_resource`.
41
 
42
  ``` cpp
43
+ 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
 
 
95
  ``` cpp
96
  virtual bool do_is_equal(const memory_resource& other) const noexcept = 0;
97
  ```
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
105
+ implementation 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