std::basic_string<CharT,Traits,Allocator>::empty
cppreference.com
<tbody>
</tbody>
<tbody class="t-dcl-rev ">
</tbody><tbody>
</tbody>
bool empty() const; |
( C++11) | |
bool empty() const noexcept; |
( C++11) ( C++20) |
|
[[nodiscard]] constexpr bool empty() const noexcept; |
( C++20) | |
, , .. begin() == end().
()
true, , false
.
#include <iostream>
#include <string>
int main()
{
std::string s;
std::boolalpha(std::cout);
std::cout << "s.empty():" << s.empty() << "\t s:'" << s << "'\n";
s = "Exemplar";
std::cout << "s.empty():" << s.empty() << "\t s:'" << s << "'\n";
s = "";
std::cout << "s.empty():" << s.empty() << "\t s:'" << s << "'\n";
}
:
s.empty():true s:''
s.empty():false s:'Exemplar'
s.empty():true s:''
| (public -) | |
| (public -) | |
| , (public -) | |
(C++17)(C++20) |
( ) |
(C++17) |
, ( ) |
(C++17) |
, (public - std::basic_string_view<CharT,Traits>)
|