Translations of this page?:

empty

Syntax:

    #include <string>
    bool empty() const;

empty()関数は、要素がからの時に true を返します。それ以外は、 false を返します。

例:

    string s1;
    string s2("");
    string s3("This is a string");
    cout.setf(ios::boolalpha);
    cout << s1.empty() << endl;
    cout << s2.empty() << endl;
    cout << s3.empty() << endl;

出力結果:

    true
    true
    false

Related Topics: size

 
• • • SitemapRecent changesRSScc