From Jason Turner

[depr.temporary.buffer]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp6o269e6r/{from.md → to.md} +51 -0
tmp/tmp6o269e6r/{from.md → to.md} RENAMED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Temporary buffers <a id="depr.temporary.buffer">[[depr.temporary.buffer]]</a>
2
+
3
+ The header `<memory>` has the following additions:
4
+
5
+ ``` cpp
6
+ namespace std {
7
+ template <class T>
8
+ pair<T*, ptrdiff_t> get_temporary_buffer(ptrdiff_t n) noexcept;
9
+ template <class T>
10
+ void return_temporary_buffer(T* p);
11
+ }
12
+ ```
13
+
14
+ ``` cpp
15
+ template <class T>
16
+ pair<T*, ptrdiff_t> get_temporary_buffer(ptrdiff_t n) noexcept;
17
+ ```
18
+
19
+ *Effects:* Obtains a pointer to uninitialized, contiguous storage for N
20
+ adjacent objects of type `T`, for some non-negative number N. It is
21
+ *implementation-defined* whether over-aligned types are
22
+ supported ([[basic.align]]).
23
+
24
+ *Remarks:* Calling `get_temporary_buffer` with a positive number `n` is
25
+ a non-binding request to return storage for `n` objects of type `T`. In
26
+ this case, an implementation is permitted to return instead storage for
27
+ a non-negative number N of such objects, where N` != n` (including
28
+ N` == 0`).
29
+
30
+ [*Note 1*: The request is non-binding to allow latitude for
31
+ implementation-specific optimizations of its memory
32
+ management. — *end note*]
33
+
34
+ *Returns:* If `n <= 0` or if no storage could be obtained, returns a
35
+ pair `P` such that `P.first` is a null pointer value and
36
+ `P.second == 0`; otherwise returns a pair `P` such that `P.first` refers
37
+ to the address of the uninitialized storage and `P.second` refers to its
38
+ capacity N (in the units of `sizeof(T)`).
39
+
40
+ ``` cpp
41
+ template <class T> void return_temporary_buffer(T* p);
42
+ ```
43
+
44
+ *Effects:* Deallocates the storage referenced by `p`.
45
+
46
+ *Requires:* `p` shall be a pointer value returned by an earlier call to
47
+ `get_temporary_buffer` that has not been invalidated by an intervening
48
+ call to `return_temporary_buffer(T*)`.
49
+
50
+ *Throws:* Nothing.
51
+