Skip to content

Commit 7d70400

Browse files
author
msebolt
committed
filler for memory
1 parent c8d3919 commit 7d70400

4 files changed

Lines changed: 152 additions & 18 deletions

File tree

docs/standard-library/cstdlib.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ms.assetid: 0a6aaebf-84e9-4b60-ae90-17e11981cf54
77
---
88
# <cstdlib>
99

10-
Includes the Standard C library header \<stdlib.h> and adds the associated names to the `std` namespace. Including this header ensures that the names declared using external linkage in the C standard library header are declared in the `std` namespace.
10+
Includes the C Standard library header \<stdlib.h> and adds the associated names to the `std` namespace. Including this header ensures that the names declared using external linkage in the C standard library header are declared in the `std` namespace.
1111

1212
> [!NOTE]
1313
> \<stdlib.h> doesn't include the type **wchar_t**.
@@ -123,7 +123,7 @@ Next, all open C streams (as mediated by the function signatures declared in <cs
123123
124124
Finally, control is returned to the host environment. If status is zero or EXIT_SUCCESS, an implementation-defined form of the status successful termination is returned. If status is EXIT_FAILURE, an implementation-defined form of the status unsuccessful termination is returned. Otherwise the status returned is implementation-defined.
125125
126-
### <a name="getevn"></a> getenv
126+
### <a name="getenv"></a> getenv
127127
128128
```cpp
129129
char* getenv(const char* name);

docs/standard-library/memory-functions.md

Lines changed: 140 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,15 @@ helpviewer_keywords: ["std::addressof [C++]", "std::align [C++]", "std::allocate
1111
|-|-|-|
1212
|[addressof](#addressof)|[align](#align)|[allocate_shared](#allocate_shared)|
1313
|[const_pointer_cast](#const_pointer_cast)|[declare_no_pointers](#declare_no_pointers)|[declare_reachable](#declare_reachable)|
14-
|[default_delete](#default_delete)|[dynamic_pointer_cast](#dynamic_pointer_cast)|[get_deleter](#get_deleter)|
14+
|[default_delete](#default_delete)|[destroy_at](../standard-library/memory-functions.md#destroy_at)|[destroy](../standard-library/memory-functions.md#destroy)|
15+
|[destroy_n](../standard-library/memory-functions.md#destroy_n)|[dynamic_pointer_cast](#dynamic_pointer_cast)|[get_deleter](#get_deleter)|
1516
|[get_pointer_safety](#get_pointer_safety)|[get_temporary_buffer](#get_temporary_buffer)|[make_shared](#make_shared)|
1617
|[make_unique](#make_unique)|[owner_less](#owner_less)|[return_temporary_buffer](#return_temporary_buffer)|
1718
|[static_pointer_cast](#static_pointer_cast)|[swap (C++ Standard Library)](#swap)|[undeclare_no_pointers](#undeclare_no_pointers)|
1819
|[undeclare_reachable](#undeclare_reachable)|[uninitialized_copy](#uninitialized_copy)|[uninitialized_copy_n](#uninitialized_copy_n)|
19-
|[uninitialized_fill](#uninitialized_fill)|[uninitialized_fill_n](#uninitialized_fill_n)|
20+
|[uninitialized_default_construct](../standard-library/memory-functions.md#uninitialized_default_construct)|[uninitialized_default_construct_n](../standard-library/memory-functions.md#uninitialized_default_construct_n)|[uninitialized_fill](#uninitialized_fill)|
21+
|[uninitialized_fill_n](#uninitialized_fill_n)|[uninitialized_move](../standard-library/memory-functions.md#uninitialized_move)|[uninitialized_move_n](../standard-library/memory-functions.md#uninitialized_move_n)|
22+
|[uninitialized_value_construct](../standard-library/memory-functions.md#uninitialized_value_construct)|[uninitialized_value_construct_n](../standard-library/memory-functions.md#uninitialized_value_construct_n)||
2023

2124
## <a name="addressof"></a> addressof
2225

@@ -233,14 +236,41 @@ The type of elements in the array to be deleted.
233236
234237
The template class describes a `deleter` that deletes scalar objects allocated with **operator new**, suitable for use with template class `unique_ptr`. It also has the explicit specialization `default_delete<Type[]>`.
235238
239+
## <a name="destroy_at"></a> destroy_at
240+
241+
```cpp
242+
template <class T>
243+
void destroy_at(T* location);
244+
```
245+
246+
Same as `location->~T()`.
247+
248+
## <a name="destroy"></a> destroy
249+
250+
```cpp
251+
template <class ForwardIterator>
252+
void destroy(ForwardIterator first, ForwardIterator last);
253+
```
254+
255+
Same as `for (; first!=last; ++first) destroy_at(addressof(*first)); `.
256+
257+
## <a name="destroy_n"></a> destroy_n
258+
259+
```cpp
260+
template <class ForwardIterator, class Size>
261+
ForwardIterator destroy_n(ForwardIterator first, Size n);
262+
```
263+
264+
Same as `for (; n > 0; (void)++first, --n) destroy_at(addressof(*first)); return first;`.
265+
236266
## <a name="dynamic_pointer_cast"></a> dynamic_pointer_cast
237267

238268
Dynamic cast to shared_ptr.
239269

240270
```cpp
241271
template <class Ty, class Other>
242-
shared_ptr<Ty>
243-
dynamic_pointer_cast(const shared_ptr<Other>& sp);
272+
shared_ptr<Ty>
273+
dynamic_pointer_cast(const shared_ptr<Other>& sp);
244274
```
245275
246276
### Parameters
@@ -1011,13 +1041,47 @@ The template function effectively executes the following:
10111041

10121042
unless the code throws an exception. In that case, all constructed objects are destroyed and the exception is rethrown.
10131043

1044+
## <a name="uninitialized_default_construct"></a> uninitialized_default_construct
1045+
1046+
```cpp
1047+
template <class ForwardIterator>
1048+
void uninitialized_default_construct(ForwardIterator first, ForwardIterator last);
1049+
```
1050+
1051+
### Remarks
1052+
1053+
Same as:
1054+
1055+
```cpp
1056+
for (; first != last; ++first)
1057+
::new (static_cast<void*>(addressof(*first)))
1058+
typename iterator_traits<ForwardIterator>::value_type;
1059+
```
1060+
1061+
## <a name="uninitialized_default_construct_n"></a> uninitialized_default_construct_n
1062+
1063+
```cpp
1064+
template <class ForwardIterator, class Size>
1065+
ForwardIterator uninitialized_default_construct_n(ForwardIterator first, Size n)
1066+
```
1067+
1068+
### Remarks
1069+
1070+
Same as:
1071+
1072+
```cpp
1073+
for (; n>0; (void)++first, --n)
1074+
::new (static_cast<void*>(addressof(*first)))
1075+
typename iterator_traits<ForwardIterator>::value_type; return first;
1076+
```
1077+
10141078
## <a name="uninitialized_fill"></a> uninitialized_fill
10151079

10161080
Copies objects of a specified value into an uninitialized destination range.
10171081

10181082
```cpp
10191083
template <class ForwardIterator, class Type>
1020-
void uninitialized_fill(ForwardIterator first, ForwardIterator last, const Type& val);
1084+
void uninitialized_fill(ForwardIterator first, ForwardIterator last, const Type& val);
10211085
```
10221086
10231087
### Parameters
@@ -1089,7 +1153,7 @@ Copies objects of a specified value into specified number of elements into an un
10891153

10901154
```cpp
10911155
template <class FwdIt, class Size, class Type>
1092-
void uninitialized_fill_n(ForwardIterator first, Size count, const Type& val);
1156+
void uninitialized_fill_n(ForwardIterator first, Size count, const Type& val);
10931157
```
10941158
10951159
### Parameters
@@ -1147,6 +1211,76 @@ int main() {
11471211
}
11481212
```
11491213
1214+
## <a name="uninitialized_move"></a> uninitialized_move
1215+
1216+
```cpp
1217+
template <class InputIterator, class ForwardIterator>
1218+
ForwardIterator uninitialized_move(InputIterator first, InputIterator last, ForwardIterator result);
1219+
```
1220+
1221+
### Remarks
1222+
1223+
Same as:
1224+
1225+
```cpp
1226+
for (; first != last; (void)++result, ++first)
1227+
::new (static_cast<void*>(addressof(*result)))
1228+
typename iterator_traits<ForwardIterator>::value_type(std::move(*first));
1229+
return result;
1230+
```
1231+
1232+
If an exception is thrown, some objects in the range might be left in a valid but unspecified state.
1233+
1234+
## <a name="uninitialized_move_n"></a> uninitialized_move_n
1235+
1236+
```cpp
1237+
template <class InputIterator, class Size, class ForwardIterator>
1238+
pair<InputIterator, ForwardIterator> uninitialized_move_n(InputIterator first, Size n, ForwardIterator result);
1239+
```
1240+
1241+
### Remarks
1242+
1243+
Same as:
1244+
1245+
```cpp
1246+
for (; n > 0; ++result, (void) ++first, --n)
1247+
::new (static_cast<void*>(addressof(*result)))
1248+
typename iterator_traits<ForwardIterator>::value_type(std::move(*first)); return {first,result};
1249+
```
1250+
1251+
If an exception is thrown, some objects in the range might be left in a valid but unspecified state.
1252+
1253+
## <a name="uninitialized_value_construct"></a> uninitialized_value_construct
1254+
1255+
```cpp
1256+
template <class ForwardIterator>
1257+
void uninitialized_value_construct(ForwardIterator first, ForwardIterator last);
1258+
```
1259+
1260+
### Remarks
1261+
1262+
Same as:
1263+
1264+
```cpp
1265+
for (; first != last; ++first)
1266+
::new (static_cast<void*>(addressof(*first)))
1267+
typename iterator_traits<ForwardIterator>::value_type();
1268+
```
1269+
1270+
## <a name="uninitialized_value_construct_n"></a> uninitialized_value_construct_n
1271+
1272+
```cpp
1273+
template <class ForwardIterator, class Size>
1274+
ForwardIterator uninitialized_value_construct_n(ForwardIterator first, Size n);
1275+
```
1276+
1277+
Same as:
1278+
```cpp
1279+
for (; n>0; (void)++first, --n)
1280+
::new (static_cast<void*>(addressof(*first)))
1281+
typename iterator_traits<ForwardIterator>::value_type(); return first;
1282+
```
1283+
11501284
## See also
11511285

11521286
[\<memory>](../standard-library/memory.md)<br/>

docs/standard-library/memory.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ Defines a class, an operator, and several templates that help allocate and free
2828
|[declare_no_pointers](../standard-library/memory-functions.md#declare_no_pointers)|Informs a garbage collector that the characters starting at a specified address and falling within the indicated block size contain no traceable pointers.|
2929
|[declare_reachable](../standard-library/memory-functions.md#declare_reachable)|Informs garbage collection that the indicated address is to allocated storage and is reachable.|
3030
|[default_delete](../standard-library/memory-functions.md#default_delete)|Deletes objects allocated with `operator new`. Suitable for use with `unique_ptr`.|
31-
|[destroy_at](../standard-library/memory-functions.md#destroy_at)||
32-
|[destroy](../standard-library/memory-functions.md#destroy)||
33-
|[destroy_n](../standard-library/memory-functions.md#destroy_n)||
31+
|[destroy_at](../standard-library/memory-functions.md#destroy_at)|Shorthand `destroy` method.|
32+
|[destroy](../standard-library/memory-functions.md#destroy)|Shorthand `destroy` method.|
33+
|[destroy_n](../standard-library/memory-functions.md#destroy_n)|Shorthand `destroy` method.|
3434
|[dynamic_pointer_cast](../standard-library/memory-functions.md#dynamic_pointer_cast)|Dynamic cast to `shared_ptr`.|
3535
|[get_deleter](../standard-library/memory-functions.md#get_deleter)|Get deleter from `shared_ptr`.|
3636
|[get_pointer_safety](../standard-library/memory-functions.md#get_pointer_safety)|Returns the type of pointer safety assumed by any garbage collector.|
@@ -45,14 +45,14 @@ Defines a class, an operator, and several templates that help allocate and free
4545
|[undeclare_reachable](../standard-library/memory-functions.md#undeclare_reachable)|Informs a `garbage_collector` that a specified memory location is not reachable.|
4646
|[uninitialized_copy](../standard-library/memory-functions.md#uninitialized_copy)|Copies objects from a specified input range into an uninitialized destination range.|
4747
|[uninitialized_copy_n](../standard-library/memory-functions.md#uninitialized_copy_n)|Creates a copy of a specified number of elements from an input iterator. The copies are put in a forward iterator.|
48-
|[uninitialized_default_construct](../standard-library/memory-functions.md#uninitialized_default_construct)||
49-
|[uninitialized_default_construct_n](../standard-library/memory-functions.md#uninitialized_default_construct_n)||
48+
|[uninitialized_default_construct](../standard-library/memory-functions.md#uninitialized_default_construct)|Shorthand `uninitialized_default_construct` method.|
49+
|[uninitialized_default_construct_n](../standard-library/memory-functions.md#uninitialized_default_construct_n)|Shorthand `uninitialized_construct` method.|
5050
|[uninitialized_fill](../standard-library/memory-functions.md#uninitialized_fill)|Copies objects of a specified value into an uninitialized destination range.|
5151
|[uninitialized_fill_n](../standard-library/memory-functions.md#uninitialized_fill_n)|Copies objects of a specified value into specified number of elements an uninitialized destination range.|
52-
|[uninitialized_move](../standard-library/memory-functions.md#uninitialized_move)||
53-
|[uninitialized_move_n](../standard-library/memory-functions.md#uninitialized_move_n)||
54-
|[uninitialized_value_construct](../standard-library/memory-functions.md#uninitialized_value_construct)||
55-
|[uninitialized_value_construct_n](../standard-library/memory-functions.md#uninitialized_value_construct_n)||
52+
|[uninitialized_move](../standard-library/memory-functions.md#uninitialized_move)|Shorthand `uninitialized_move` method.|
53+
|[uninitialized_move_n](../standard-library/memory-functions.md#uninitialized_move_n)|Shorthand `uninitialized_move` method.|
54+
|[uninitialized_value_construct](../standard-library/memory-functions.md#uninitialized_value_construct)|Shorthand `uninitialized_value_construct` method.|
55+
|[uninitialized_value_construct_n](../standard-library/memory-functions.md#uninitialized_value_construct_n)|Shorthand `uninitialized_value_construct` method.|
5656

5757
### Operators
5858

docs/standard-library/new-functions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ A value of type *T\** that points to X.
3737
3838
Also referred to as a pointer optimization barrier.
3939
40-
An invocation of this function may be used in a core constant expression whenever the value of its argument may be used in a core constant expression. A byte of storage is reachable through a pointer value that points to an object Y if it is within the storage occupied by Y, an object that's pointer-interconvertible with Y, or the immediately-enclosing array object if Y is an array element. The program is ill-formed if T is a function type or cv void. If a new object is created in storage occupied by an existing object of the same type, a pointer to the original object can be used to refer to the new object unless the type contains const or reference members; in the latter cases, this function can be used to obtain a usable pointer to the new object.
40+
Used as a constant expression when the value of its argument may be used in a constant expression. A byte of storage is reachable through a pointer value that points to an object if within the storage occupied by another object, an object with a similar pointer.
4141
4242
### Example
4343

0 commit comments

Comments
 (0)