public member function
<string>
std::string::empty
bool empty() const noexcept;
Test if string is empty
This function does not modify the value of the string in any way. To clear the content of a string, see string::clear.
Parameters
noneReturn Value
true if the string length is 0, false otherwise.Example
|
|
This program reads the user input line by line and stores it into string content until an empty line is introduced.
Complexity
Unspecified, but generally constant.
Constant.
Iterator validity
No changes.Data races
The object is accessed.Exception safety
No-throw guarantee: this member function never throws exceptions.See also
- string::clear
- Clear string (public member function)
- string::size
- Return length of string (public member function)
- string::length
- Return length of string (public member function)