You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When performance optimization is needed, consider using:
66
65
67
-
- The [`array`](../standard-library/array-class-stl.md) type when embedding is important, for example, as a class member.
68
-
69
66
- Unordered associative containers such as [`unordered_map`](../standard-library/unordered-map-class.md). These have lower per-element overhead and constant-time lookup, but they can be harder to use correctly and efficiently.
70
-
71
67
- Sorted `vector`. For more information, see [Algorithms](../standard-library/algorithms.md).
72
68
73
69
Don't use C-style arrays. For older APIs that need direct access to the data, use accessor methods such as `f(vec.data(), vec.size());` instead. For more information about containers, see [C++ Standard Library Containers](../standard-library/stl-containers.md).
@@ -79,11 +75,8 @@ Before you assume that you need to write a custom algorithm for your program, fi
79
75
Here are some important examples:
80
76
81
77
-`for_each`, the default traversal algorithm (along with range-based `for` loops).
82
-
83
78
-`transform`, for not-in-place modification of container elements
84
-
85
79
-`find_if`, the default search algorithm.
86
-
87
80
-`sort`, `lower_bound`, and the other default sorting and searching algorithms.
88
81
89
82
To write a comparator, use strict **`<`** and use *named lambdas* when you can.
0 commit comments