Crossware

Table of Contents        Previous topic       Next topic       

C++ COMPILER LIBRARY FUNCTIONS->String Class Functions->Member Functions->Constructors

#include <string>

explicit string(void)

Constructs an empty object of class string.

The explicit qualifier is left over from the C++ to Embedded C++ removal of the allocator parameter and is meaningless for class functions with no parameters.

string(const string& str, size_t pos = 0, size_t n = npos)

Constructs a object of class string as a copy of an existing string str.

str is copied starting from character str[pos].  The number of characters copied is the smaller size of n and str.size().

It is required that pos <= str.size().

string(const char* s, size_t n)

Constructs a object of class string this is initialised by the array of char of length n with a first element s.

It is required that s shall not be a null pointer and that n < npos.

string(const char* s)

Constructs a object of class string this is initialised by the array of char of length strlen(s) with a first element s.

It is required that s shall not be a null pointer.

string(size_t n, char c)

Constructs a object of class string this is initialised by n copies of c.

It is required that that n < npos.