I was interested to know about the last constructor for the one std::stringmentioned here . It says:
template<class InputIterator> string (InputIterator begin, InputIterator end);
If it InputIteratoris an integral type, it behaves like the sixteenth version of the constructor (the one that is above this), by inputting and starting inputting the type:
string(static_cast<size_t>(begin),static_cast<char>(end));
In any other case, the parameters are taken as iterators, and the content is initialized with the values of the elements that come from the element specified by the iterator, begin with the element immediately before the one indicated at the end of the iterator.
So what does this mean if InputIteratoris char *?
EDIT: Good, my bad. I just realized that in the documentation it contains an integral type, not a primitive type, so the question does not apply to this example. But still, are pointer primitives?
source
share