C++ String Library - cbegin
Description
It return const_iterator to beginning.
Declaration
Following is the declaration for std::string::cbegin.
const_iterator cbegin() const noexcept;
C++11
const_iterator cbegin() const noexcept;
Parameters
none
Return Value
It returns a const_iterator to the beginning of the string.
Exceptions
Never throw any exceptions.
Example
In below example for std::string::cbegin.
#include <iostream>
#include <string>
int main () {
std::string str ("Tutorials Point");
for (auto it=str.cbegin(); it!=str.cend(); ++it)
std::cout << *it;
std::cout << '\n';
return 0;
}
The sample output should be like this −
Tutorials Point
string.htm
Advertisements