The forward_list::cbegin() is a function in C++ STL which returns a constant iterator pointing to the first element of the forward_list.
Parameters: This function does not accept any parameter.
Return Value: This function returns an iterator that points to the const content. Since the iterator is not constant it can be increased or decreased or modified but as it cannot be used to modify its content even if the forward list is not constant. If the forward list is empty, the iterator returned by the function will not be dereferenced.
The following programs illustrate the use of the function:
1st element of sample: 45
sample: 7 4 9 15
- deque cbegin() in C++ STL
- unordered_map cbegin in C++ STL
- unordered_multimap cbegin() function in C++ STL
- match_results cbegin() add cend() in C++ STL
- unordered_multiset cbegin() function in C++ STL
- map cbegin() and cend() function in C++ STL
- set cbegin() and cend() function in C++ STL
- unordered_set cbegin() function in C++ STL
- list cbegin() and cend() function in C++ STL
- multiset cbegin() and cend() function in C++ STL
- array::cbegin() and array::cend() in C++ STL
- multimap::cbegin() and multimap::cend() in C++ STL
- vector :: cbegin() and vector :: cend() in C++ STL
- How to implement our own Vector Class in C++?
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.