Cbegin Cend Dev C++

  • Related Questions & Answers
  • Returns a constiterator pointing to the first element in the array container. A constiterator is an iterator that points to const content. This iterator can be increased and decreased (unless it is itself also const), just like the iterator returned by array::begin, but it cannot be used to modify the contents it points to, even if the array object is not itself const.
  • C C Java SQL In the above example, cbegin function is used to return a constant iterator pointing to the first element in the mymultiset multiset.

Set cbegin and cend function in C STL The set::cbegin is a built-in function in C STL which returns a constant iterator pointing to the first element in the container. The iterator cannot be used to modify the elements in the set container.

  • Selected Reading
C++Server Side ProgrammingProgramming

In this article we will be discussing the working, syntax and examples of match_results::cbegin() and match_results::cend() functions in C++ STL.

What is a match_results in C++ STL?

std::match_results is a specialized container-like class which is used to hold the collection of character sequences which are matched. In this container class a regex match operation finds the matches of the target sequence.

What is match_results::cbegin()?

match_results::cbegin() function is an inbuilt function in C++ STL, which is defined in <regex> header file. This function returns the constant iterator which is pointing to the first element in the match_results container. Constant iterator can’t be used to do modifications in the container, constant iterator is used for just iterating through the container.

Syntax

Parameters

This function accepts no parameter.

Return value

This function returns constant iterator which is pointing to the first element of the match_results container.

Example

Example

Output

If we run the above code it will generate the following output −

What is match_results::cend()?

Cbegin Cend Dev C++

match_results::cend() function is an inbuilt function in C++ STL, which is defined in <regex> header file. This function returns a constant iterator which is point towards the element next to the last element of match_results container. This function works the same as the match_results::end().

Syntax

Parameters

This function accepts no parameter.

Return value

Cbegin Cend

This function returns a constant iterator which is pointing to the past the last element of the match_results container.

Example

Cend

Output

Dev C++ 5.11

If we run the above code it will generate the following output −