Wednesday, April 22, 2015

C++: Constructing a std::string from std::vector

std::vector<char> is actually a vector of the characters that make up the string.

There is a constructor for std::string that can be used for this i.e. std::string s(v.begin(),v.end());

Reference: http://stackoverflow.com/questions/5115166/how-to-construct-a-stdstring-from-a-stdvectorchar

No comments:

Post a Comment