From Jason Turner

[mem.poly.allocator.mem]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp2um8zr_b/{from.md → to.md} +13 -6
tmp/tmp2um8zr_b/{from.md → to.md} RENAMED
@@ -1,9 +1,9 @@
1
  #### Member functions <a id="mem.poly.allocator.mem">[[mem.poly.allocator.mem]]</a>
2
 
3
  ``` cpp
4
- [[nodiscard]] Tp* allocate(size_t n);
5
  ```
6
 
7
  *Effects:* If `numeric_limits<size_t>::max() / sizeof(Tp) < n`, throws
8
  `bad_array_new_length`. Otherwise equivalent to:
9
 
@@ -22,11 +22,11 @@ void deallocate(Tp* p, size_t n);
22
  `memory_rsrc->deallocate(p, n * sizeof(Tp), alignof(Tp))`.
23
 
24
  *Throws:* Nothing.
25
 
26
  ``` cpp
27
- [[nodiscard]] void* allocate_bytes(size_t nbytes, size_t alignment = alignof(max_align_t));
28
  ```
29
 
30
  *Effects:* Equivalent to:
31
  `return memory_rsrc->allocate(nbytes, alignment);`
32
 
@@ -42,11 +42,11 @@ void deallocate_bytes(void* p, size_t nbytes, size_t alignment = alignof(max_ali
42
  *Effects:* Equivalent to
43
  `memory_rsrc->deallocate(p, nbytes, alignment)`.
44
 
45
  ``` cpp
46
  template<class T>
47
- [[nodiscard]] T* allocate_object(size_t n = 1);
48
  ```
49
 
50
  *Effects:* Allocates memory suitable for holding an array of `n` objects
51
  of type `T`, as follows:
52
 
@@ -67,11 +67,11 @@ template<class T>
67
 
68
  *Effects:* Equivalent to `deallocate_bytes(p, n*sizeof(T), alignof(T))`.
69
 
70
  ``` cpp
71
  template<class T, class... CtorArgs>
72
- [[nodiscard]] T* new_object(CtorArgs&&... ctor_args);
73
  ```
74
 
75
  *Effects:* Allocates and constructs an object of type `T`, as follows.
76
  Equivalent to:
77
 
@@ -95,11 +95,11 @@ template<class T>
95
  ```
96
 
97
  *Effects:* Equivalent to:
98
 
99
  ``` cpp
100
- allocator_traits<polymorphic_allocator>::destroy(*this, p);
101
  deallocate_object(p);
102
  ```
103
 
104
  ``` cpp
105
  template<class T, class... Args>
@@ -108,16 +108,23 @@ template<class T, class... Args>
108
 
109
  *Mandates:* Uses-allocator construction of `T` with allocator `*this`
110
  (see  [[allocator.uses.construction]]) and constructor arguments
111
  `std::forward<Args>(args)...` is well-formed.
112
 
113
- *Effects:* Construct a `T` object in the storage whose address is
114
  represented by `p` by uses-allocator construction with allocator `*this`
115
  and constructor arguments `std::forward<Args>(args)...`.
116
 
117
  *Throws:* Nothing unless the constructor for `T` throws.
118
 
 
 
 
 
 
 
 
119
  ``` cpp
120
  polymorphic_allocator select_on_container_copy_construction() const;
121
  ```
122
 
123
  *Returns:* `polymorphic_allocator()`.
 
1
  #### Member functions <a id="mem.poly.allocator.mem">[[mem.poly.allocator.mem]]</a>
2
 
3
  ``` cpp
4
+ Tp* allocate(size_t n);
5
  ```
6
 
7
  *Effects:* If `numeric_limits<size_t>::max() / sizeof(Tp) < n`, throws
8
  `bad_array_new_length`. Otherwise equivalent to:
9
 
 
22
  `memory_rsrc->deallocate(p, n * sizeof(Tp), alignof(Tp))`.
23
 
24
  *Throws:* Nothing.
25
 
26
  ``` cpp
27
+ void* allocate_bytes(size_t nbytes, size_t alignment = alignof(max_align_t));
28
  ```
29
 
30
  *Effects:* Equivalent to:
31
  `return memory_rsrc->allocate(nbytes, alignment);`
32
 
 
42
  *Effects:* Equivalent to
43
  `memory_rsrc->deallocate(p, nbytes, alignment)`.
44
 
45
  ``` cpp
46
  template<class T>
47
+ T* allocate_object(size_t n = 1);
48
  ```
49
 
50
  *Effects:* Allocates memory suitable for holding an array of `n` objects
51
  of type `T`, as follows:
52
 
 
67
 
68
  *Effects:* Equivalent to `deallocate_bytes(p, n*sizeof(T), alignof(T))`.
69
 
70
  ``` cpp
71
  template<class T, class... CtorArgs>
72
+ T* new_object(CtorArgs&&... ctor_args);
73
  ```
74
 
75
  *Effects:* Allocates and constructs an object of type `T`, as follows.
76
  Equivalent to:
77
 
 
95
  ```
96
 
97
  *Effects:* Equivalent to:
98
 
99
  ``` cpp
100
+ destroy(p);
101
  deallocate_object(p);
102
  ```
103
 
104
  ``` cpp
105
  template<class T, class... Args>
 
108
 
109
  *Mandates:* Uses-allocator construction of `T` with allocator `*this`
110
  (see  [[allocator.uses.construction]]) and constructor arguments
111
  `std::forward<Args>(args)...` is well-formed.
112
 
113
+ *Effects:* Constructs a `T` object in the storage whose address is
114
  represented by `p` by uses-allocator construction with allocator `*this`
115
  and constructor arguments `std::forward<Args>(args)...`.
116
 
117
  *Throws:* Nothing unless the constructor for `T` throws.
118
 
119
+ ``` cpp
120
+ template<class T>
121
+ void destroy(T* p);
122
+ ```
123
+
124
+ *Effects:* Equivalent to `p->T̃()`.
125
+
126
  ``` cpp
127
  polymorphic_allocator select_on_container_copy_construction() const;
128
  ```
129
 
130
  *Returns:* `polymorphic_allocator()`.