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
Title: 'max_size()'# Required; the file name should be the same as the title, but lowercase, with dashes instead of spaces, and all punctuation removed
3
-
Description: 'Returns the maximum number of elements that the container can theoretically hold.'# Required; ideally under 150 characters and starts with a present-tense verb (used in search engine results and content previews)
4
-
Subjects: # Please only use Subjects in the subjects.md file (https://github.com/Codecademy/docs/blob/main/documentation/subjects.md). If that list feels insufficient, feel free to create a new Subject and add it to subjects.md in your PR!
5
-
- 'Computer Science'
2
+
Title: 'max_size()'
3
+
Description: 'Returns the maximum number of elements that the container can theoretically hold.'
4
+
Subjects:
6
5
- 'Code Foundations'
7
-
Tags: # Please only use Tags in the tags.md file (https://github.com/Codecademy/docs/blob/main/documentation/tags.md). If that list feels insufficient, feel free to create a new Tag and add it to tags.md in your PR!
8
-
- 'Methods'
6
+
- 'Computer Science'
7
+
Tags:
9
8
- 'Containers'
9
+
- 'Methods'
10
10
- 'STL'
11
-
CatalogContent:# Please use course/path landing page slugs, rather than linking to individual content items. If listing multiple items, please put the most relevant one first
11
+
CatalogContent:
12
12
- 'learn-c-plus-plus'
13
13
- 'paths/computer-science'
14
14
---
15
15
16
-
The **`.max_size()`**method returns the maximum number of elements that a container can theoretically hold. This value depends on system and library implementation limitations, not the actual available memory.
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.
17
17
18
18
## Syntax
19
19
20
20
```pseudo
21
21
unordered_set_name.max_size()
22
22
```
23
23
24
-
-`unordered_set_name`: The name of the `unordered_set` container.
24
+
**Parameters:**
25
+
26
+
This function takes no parameters.
27
+
28
+
**Return value:**
25
29
26
30
The method returns a value of type `size_type`, representing the theoretical maximum number of elements.
27
31
28
32
## Example 1: Basic Usage
29
33
34
+
In this example the program prints the maximum number of elements an `unordered_set` can theoretically hold:
0 commit comments