Default Constructor

This is the prototype for the default constructor:

explicit basic_string(const Allocator& a = Allocator());

Typically, you would accept the default argument for the allocator class and would use the constructor to create empty strings:

string bean;
wstring theory;

The following relationships hold after the default constructor is called:

• The data() method returns a non-null pointer to which 0 can be added.

• The size() method returns 0.

• The return value for capacity() is not specified.

Suppose you assign the value returned by data() to the pointer str. In this case, the first condition means str + 0 is valid.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.11.247