Skip to content

Commit 22b8191

Browse files
Revise 'end()' documentation for clarity and details
Updated the description of the 'end()' function for clarity and added parameters section. Modified example notes and removed sample output for bucket elements.
1 parent 022e83c commit 22b8191

File tree

1 file changed

+8
-14
lines changed
  • content/cpp/concepts/unordered-set/terms/end

1 file changed

+8
-14
lines changed

content/cpp/concepts/unordered-set/terms/end/end.md

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
---
12
Title: 'end()'
2-
Description: 'Returns an iterator that points to the past-the-end position of the unordered set or the end position in a specific bucket.'
3+
Description: 'Returns an iterator pointing just past the last element of the unordered set, marking the end of the container’s range.'
34
Subjects:
45
- 'Code Foundations'
56
- 'Computer Science'
@@ -20,6 +21,10 @@ The **`end()`** method returns an iterator that points to the past-the-end posit
2021
unordered_set_name.end();
2122
```
2223

24+
**Parameters:**
25+
26+
The `end()` function takes no parameters.
27+
2328
**Return value:**
2429

2530
Returns an `iterator` pointing to the past-the-end position of the `unordered_set`.
@@ -40,7 +45,7 @@ A `local_iterator` pointing to the past-the-end position in bucket `n`. If the b
4045

4146
## Example
4247

43-
This example shows iterating over an `unordered_set` using `begin()` and `end()`:
48+
In this example, iteration runs from `begin()` to `end()` to print every element in the `unordered_set`:
4449

4550
```cpp
4651
#include <iostream>
@@ -67,7 +72,7 @@ A sample output might be:
6772
15
6873
```
6974

70-
> **Note:** The iterator returned by `end()` marks the boundary for iteration and cannot be dereferenced.
75+
> **Note:** The output order may vary because `unordered_set` does not store elements in any defined sequence.
7176
7277
## Codebyte Example
7378

@@ -95,14 +100,3 @@ int main() {
95100
return 0;
96101
}
97102
```
98-
99-
A sample output might be:
100-
101-
```shell
102-
Elements in bucket 0:
103-
cat
104-
dog
105-
lion
106-
```
107-
108-
Exact elements shown depend on the hash function and bucket count; your output may differ.

0 commit comments

Comments
 (0)