Char** to std::vector<std::string>

Hello,

I was googling without success to find the "canonical" way to transfer values from char** to std::vector<std::string>.

Could help?

S.



Last edited on
A string can be constructed with a C string and a vector can be constructed by iterators ( as pointers )
Example:
1
2
3
char **someCstrings;
int numberOfCstrings;
std::vector<std::string> myvector ( someCstrings, someCstrings+numberOfCstrings); // constructor 
Thanks Bazzy,

But... Is there also a way to know the numberOfCstrings before the call of the std::vector constructor ?

S.
Last edited on
Not really, when you have an array in a pointer you should know the size of it
Topic archived. No new replies allowed.