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
{{ message }}
This repository was archived by the owner on Feb 27, 2026. It is now read-only.
Copy file name to clipboardExpand all lines: content/cpp/concepts/unordered-set/terms/max-size/max-size.md
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
Title: 'max_size()'
3
-
Description: 'Returns the maximum number of elements that the container can theoretically hold.'
3
+
Description: 'Returns the maximum number of elements that an unordered_set can theoretically hold.'
4
4
Subjects:
5
5
- 'Code Foundations'
6
6
- 'Computer Science'
@@ -13,7 +13,7 @@ CatalogContent:
13
13
- 'paths/computer-science'
14
14
---
15
15
16
-
The **`.max_size()`** member function returns the maximum number of elements a container can theoretically hold. This limit depends on the system and the implementation of the standard library, not on actual available memory.
16
+
The **`.max_size()`** member [function](https://www.codecademy.com/resources/docs/cpp/functions) returns the maximum number of elements an `unordered_set` can theoretically hold. This limit depends on the system and the implementation of the standard library, not on actual available memory.
17
17
18
18
## Syntax
19
19
@@ -31,7 +31,7 @@ The method returns a value of type `size_type`, representing the theoretical max
31
31
32
32
## Example 1: Basic Usage
33
33
34
-
In this example the program prints the maximum number of elements an `unordered_set` can theoretically hold:
34
+
In this example, the program prints the maximum number of elements an `unordered_set` can theoretically hold:
35
35
36
36
```cpp
37
37
#include<iostream>
@@ -46,17 +46,17 @@ int main() {
46
46
}
47
47
```
48
48
49
-
This example outputs the maximum possible size of the `unordered_set`:
49
+
The output will be:
50
50
51
51
```shell
52
52
Maximum size: 1152921504606846975
53
53
```
54
54
55
55
> **Note:** The actual value may vary depending on the system and implementation.
56
56
57
-
## Example 2: Different Data Types
57
+
## Example 2: Using Different Data Types
58
58
59
-
In this example the `max_size()` value is shown for `unordered_set` containers holding different data types:
59
+
In this example, the `max_size()` value is shown for `unordered_set` containers holding different [data types](https://www.codecademy.com/resources/docs/cpp/data-types):
0 commit comments