Skip to content

Commit 3391bbf

Browse files
authored
Merge pull request #2832 from TylerMSFT/twhitney-github2096
add note about deprecation
2 parents a229152 + a1eaa60 commit 3391bbf

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

docs/standard-library/allocators-header.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,18 @@ Defines several templates that help allocate and free memory blocks for node-bas
1515
#include <allocators>
1616
```
1717

18+
> [!NOTE]
19+
> \<allocators> is deprecated, starting with Visual Studio 2019 version 16.3.
20+
1821
## Remarks
1922

20-
The \<allocators> header provides six allocator templates that can be used to select memory-management strategies for node-based containers. For use with these templates, it also provides several different synchronization filters to tailor the memory-management strategy to a variety of different multithreading schemes (including none). Matching a memory management strategy to the known memory usage patterns, and synchronization requirements, of a particular application can often increase the speed or reduce the overall memory requirements of an application.
23+
The \<allocators> header provides six allocator templates that can be used to select memory-management strategies for node-based containers. For use with these templates, it also provides several different synchronization filters to tailor the memory-management strategy to a variety of different multithreading schemes (including none). You can speed up your app, or reduce its memory requirements, by matching a memory management strategy to its memory usage patterns and synchronization requirements.
2124

2225
The allocator templates are implemented with reusable components that can be customized or replaced to provide additional memory-management strategies.
2326

24-
The node-based containers in the C++ Standard Library (std::list, std::set, std::multiset, std::map and std::multimap) store their elements in individual nodes. All the nodes for a particular container type are the same size, so the flexibility of a general-purpose memory manager is not needed. Because the size of each memory block is known at compile time, the memory manager can be much simpler and faster.
27+
The node-based containers in the C++ Standard Library (std::list, std::set, std::multiset, std::map, and std::multimap) store their elements in individual nodes. All the nodes for a particular container type are the same size, so the flexibility of a general-purpose memory manager is not needed. Because the size of each memory block is known at compile time, the memory manager can be much simpler and faster.
2528

26-
When used with containers that are not node-based (such as the C++ Standard Library containers std::vector std::deque, and std::basic_string), the alllocator templates will work correctly, but are not likely to provide any performance improvement over the default allocator.
29+
When used with containers that are not node-based (such as the C++ Standard Library containers std::vector std::deque, and std::basic_string), the allocator templates will work correctly, but are not likely to provide any performance improvement over the default allocator.
2730

2831
An allocator is a class template that describes an object that manages storage allocation and freeing for objects and arrays of objects of a designated type. Allocator objects are used by several container class templates in the C++ Standard Library.
2932

@@ -71,7 +74,7 @@ _Lst1 allocates nodes with `allocator_chunklist` and the [sync_per_thread](../st
7174

7275
A block allocator is a cache or a filter. A cache is a class template that takes one argument of type std::size_t. It defines a block allocator that allocates and deallocates memory blocks of a single size. It must obtain memory using operator **new**, but it need not make a separate call to operator **new** for each block. It may, for example, suballocate from a larger block or cache deallocated blocks for subsequent reallocation.
7376

74-
With a compiler that cannot compile rebind the value of the std::size_t argument used when the template was instantiated is not necessarily the value of the argument _Sz passed to a cache's member functions allocate and deallocate.
77+
With a compiler that cannot rebind the value of the std::size_t argument used when the template was instantiated is not necessarily the value of the argument _Sz passed to a cache's member functions allocate and deallocate.
7578

7679
\<allocators> provides the following cache templates:
7780

@@ -81,7 +84,7 @@ With a compiler that cannot compile rebind the value of the std::size_t argument
8184

8285
- [cache_chunklist](../standard-library/cache-chunklist-class.md)
8386

84-
A filter is a block allocator that implements its member functions using another block allocator which is passed to it as a template argument. The most common form of filter is a synchronization filter, which applies a synchronization policy to control access to the member functions of an instance of another block allocator. \<allocators> provides the following synchronization filters:
87+
A filter is a block allocator that implements its member functions using another block allocator, which is passed to it as a template argument. The most common form of filter is a synchronization filter, which applies a synchronization policy to control access to the member functions of an instance of another block allocator. \<allocators> provides the following synchronization filters:
8588

8689
- [sync_none](../standard-library/sync-none-class.md)
8790

@@ -97,7 +100,7 @@ A synchronization policy determines how an allocator instance handles simultaneo
97100

98101
If a compiler supports compiling both single-threaded and multi-threaded applications, the default synchronization filter for single-threaded applications is `sync_none`; for all other cases it is `sync_shared`.
99102

100-
The cache template `cache_freelist` takes a max class argument which determines the maximum number of elements to be stored in the free list.
103+
The cache template `cache_freelist` takes a max class argument, which determines the maximum number of elements to be stored in the free list.
101104

102105
\<allocators> provides the following max classes:
103106

0 commit comments

Comments
 (0)