Skip to content

Commit a566d75

Browse files
minor content fixes
1 parent e91dada commit a566d75

File tree

1 file changed

+13
-7
lines changed
  • content/cpp/concepts/unordered-set/terms/begin

1 file changed

+13
-7
lines changed

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

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,32 @@
22
Title: '.begin()'
33
Description: 'Returns an iterator pointing to the first element in the unordered_set.'
44
Subjects:
5-
- 'Computer Science'
65
- 'Code Foundations'
6+
- 'Computer Science'
77
Tags:
8-
- 'Methods'
9-
- 'Unordered Sets'
108
- 'Iterators'
9+
- 'Methods'
10+
- 'Sets'
1111
CatalogContent:
1212
- 'learn-c-plus-plus'
1313
- 'paths/computer-science'
1414
---
1515

16-
The **`.begin()`** method returns an iterator pointing to the first element in the `unordered_set` container. Since `unordered_set` is an unordered container, the "first" element is not determined by any particular order.
16+
The **`.begin()`** method returns an iterator pointing to the first element in the `unordered_set` container. Because `unordered_set` does not maintain sorted order, the element returned by `.begin()` is simply the first element in its internal bucket structure, not the "smallest" or "first" in any logical sense.
1717

1818
## Syntax
1919

20-
```cpp
20+
```pseudo
2121
unordered_set.begin();
2222
```
2323

24-
The method takes no parameters and returns an iterator to the first element. If the container is empty, the returned iterator will be equal to `.end()`.
24+
**Parameters:**
25+
26+
The `.begin()` method takes no parameters.
27+
28+
**Return value:**
29+
30+
Returns an iterator to the first element. If the container is empty, the iterator equals `.end()`.
2531

2632
## Example
2733

@@ -45,7 +51,7 @@ int main() {
4551

4652
This outputs the elements in the unordered_set (order may vary):
4753

48-
```
54+
```shell
4955
Elements in the unordered_set: 50 40 30 20 10
5056
```
5157

0 commit comments

Comments
 (0)