public member function
<string>
std::basic_string::emptybool empty() const noexcept;
Test whether string is empty
Returns whether the basic_string is empty (i.e. whether its length is 0).This function does not modify the value of the string in any way. To clear the content of a basic_string, see basic_string::clear.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// string::empty
#include <iostream>
#include <string>
int main ()
{
std::string content;
std::string line;
std::cout << "Please introduce a text. Enter an empty line to finish:\n";
do {
getline(std::cin,line);
content += line + '\n';
} while (!line.empty());
std::cout << "The text you introduced was:\n" << content;
return 0;
}
Unspecified, but generally constant.
Constant.
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