The various basic_string constructors construct a string object for character sequence manipulations. All constructors include an Allocator argument that is used for memory allocation.
explicit basic_string (const Allocator& a = Allocator());
This default constructor, constructs an empty string. A zero sized string that may be copied to is created.
basic_string (const basic_string& str, size_type pos = 0, size_type n = npos, const Allocator& a = Allocator());
This constructor takes a string class argument and creates a copy of that string, with size of the length of that string and a capacity at least as large as that string.
An exception is thrown upon failure
basic_string (const charT* s, size_type n, const Allocator& a = Allocator());
This constructor takes a const char array argument and creates a copy of that array with the size limited to the size_type argument.
The charT* argument shall not be a null pointer
An exception is thrown upon failure
basic_string (const charT* s, const Allocator& a = Allocator());
This constructor takes an const char array argument. The size is determined by the size of the char array.
Th e charT* argument shall not be a null pointer
basic_string (size_type n, charT c, const Allocator& a = Allocator());
This constructor creates a string of size_type n size repeating charT c as the filler.
A length_error is thrown if n is less than npos.
template<class InputIterator> basic_string (InputIterator begin, InputIterator end, const Allocator& a = Allocator());
This iterator string takes InputIterator arguments and creates a string with its first position starts with begin and its ending position is end. Size is the distance between beginning and end.