The unordered_set::end() function is a built-in function in C++ STL which returns an iterator pointing to the past-the-end-element. This iterator does not directly point to an element, rather it points to the location just after the last element.
umap_name.end() or, umap_name.end(int i)
Parameters: This function takes a single integer parameter which is optional.
- If the parameter is not passed then the function returns an iterator pointing to the past-the-end element. Actually, it does not point to any element of the set, but it points to the position following the last element of the container.
- If the parameter is passed then the function returns an iterator pointing to the past-the-end element of i-th bucket. As in the previous case, it does not point to any element of the set, but it points to the position following the last element of i-th bucket.
So the iterator returned by unordered_set::end() cannot be dereferenced.
Below programs illustrate the unordered_set::end() function:
6 8 7 2 4 15 10 5
Bucket 0 Contains: Bucket 1 Contains: Bucket 2 Contains: 2 Bucket 3 Contains: Bucket 4 Contains: 4 15 Bucket 5 Contains: 5 Bucket 6 Contains: 6 Bucket 7 Contains: 7 Bucket 8 Contains: 8 Bucket 9 Contains: Bucket 10 Contains: 10
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Median of sliding window in an array | Set 2
- CheckBox in Kotlin
- RadioGroup in Kotlin
- ImageView in Kotlin
- VideoView in Kotlin
- PPP Full Form
- Node.js URLsearchParams API
- Difference between process.nextTick() and setImmediate() Methods
- Node.js Child Process
- How to get the value in an input text box using jQuery ?
- Strict Aliasing Rule in C with Examples
- Difference between cout and puts() in C++ with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.