3.3.9 使用empty()成员函数
empty()成员函数返回bool型值,如果string对象为空,则返回true,否则返回false。下面的代码使用了empty():
if (phrase.empty()) { cout << "\nThe phrase is no more.\n"; }