forward_list::cbefore_begin() is an inbuilt function in CPP STL which returns a constant random access iterator which points to the position before the first element of the forward_list. The iterator obtained by this function can be used to iterate in the container but cannot be used to modify the content of the object to which it is pointing, even if the object itself is not constant.
Parameters: The function does not accept any parameter.
Return value: The function returns a constant random access iterator which points to the position before the first element of the forward_list.
Below program demonstrates the above function:
Element of the list are: 10 20 30 40 50
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.
- Check if Array elements can be maximized upto M by adding all elements from another array
- Why do we need reference variables if we have pointers
- Similarities and Difference between Java and C++
- Macros and its types in C/C++
- How to find index of a given element in a Vector in C++
- Print all lexicographical greater permutations of a given string
- Introduction to Complex Objects and Composition
- sort() vs. partial_sort() vs. nth_element() + sort() in C++ STL
- Difference between user defined function and library function in C/C++
- NULL undeclared error in C/C++ and how to resolve it
- std::remove_const in C++ with Examples
- All possible values of floor(N/K) for all values of K
- Finding Median of unsorted Array in linear time using C++ STL
- Average of Cubes of first N natural numbers
- Top 10 Programming Languages for Blockchain Development
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.