public member function
<string>
std::basic_string::frontcharT& front();const charT& front() const;
Access first character
Returns a reference to the first character of the basic_string.Unlike member basic_string::begin, which returns an iterator to this same character, this function returns a direct reference.
This function shall not be called on empty strings.
If the basic_string object is const-qualified, the function returns a const charT&. Otherwise, it returns a charT&.
charT is basic_string's character type (i.e., its first template parameter).
1
2
3
4
5
6
7
8
9
10
11
// string::front
#include <iostream>
#include <string>
int main ()
{
std::string str ("test string");
str.front() = 'T';
std::cout << str << '\n';
return 0;
}
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4