From Jason Turner

[mem.res.monotonic.buffer.mem]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpa1vqby3r/{from.md → to.md} +57 -0
tmp/tmpa1vqby3r/{from.md → to.md} RENAMED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### `monotonic_buffer_resource` members <a id="mem.res.monotonic.buffer.mem">[[mem.res.monotonic.buffer.mem]]</a>
2
+
3
+ ``` cpp
4
+ void release();
5
+ ```
6
+
7
+ *Effects:* Calls `upstream_rsrc->deallocate()` as necessary to release
8
+ all allocated memory.
9
+
10
+ [*Note 1*: The memory is released back to `upstream_rsrc` even if some
11
+ blocks that were allocated from `this` have not been deallocated from
12
+ `this`. — *end note*]
13
+
14
+ ``` cpp
15
+ memory_resource* upstream_resource() const;
16
+ ```
17
+
18
+ *Returns:* The value of `upstream_rsrc`.
19
+
20
+ ``` cpp
21
+ void* do_allocate(size_t bytes, size_t alignment) override;
22
+ ```
23
+
24
+ *Returns:* A pointer to allocated storage
25
+ ([[basic.stc.dynamic.deallocation]]) with a size of at least `bytes`.
26
+ The size and alignment of the allocated memory shall meet the
27
+ requirements for a class derived from `memory_resource` ([[mem.res]]).
28
+
29
+ *Effects:* If the unused space in `current_buffer` can fit a block with
30
+ the specified `bytes` and `alignment`, then allocate the return block
31
+ from `current_buffer`; otherwise set `current_buffer` to
32
+ `upstream_rsrc->allocate(n, m)`, where `n` is not less than
33
+ `max(bytes, next_buffer_size)` and `m` is not less than `alignment`, and
34
+ increase `next_buffer_size` by an *implementation-defined* growth factor
35
+ (which need not be integral), then allocate the return block from the
36
+ newly-allocated `current_buffer`.
37
+
38
+ *Throws:* Nothing unless `upstream_rsrc->allocate()` throws.
39
+
40
+ ``` cpp
41
+ void do_deallocate(void* p, size_t bytes, size_t alignment) override;
42
+ ```
43
+
44
+ *Effects:* None.
45
+
46
+ *Throws:* Nothing.
47
+
48
+ *Remarks:* Memory used by this resource increases monotonically until
49
+ its destruction.
50
+
51
+ ``` cpp
52
+ bool do_is_equal(const memory_resource& other) const noexcept override;
53
+ ```
54
+
55
+ *Returns:*
56
+ `this == dynamic_cast<const monotonic_buffer_resource*>(&other)`.
57
+