Hello
is there fast way to convert c char** to std::string[] array without loop the char** ?
Printable View
Hello
is there fast way to convert c char** to std::string[] array without loop the char** ?
Nope.
Well there's probably some cute one-liner statement you could use from the STL, but that would only hide the loop from your code, and it wouldn't make it noticeably any faster.
Why are you trying to optimise something which only happens once anyway?
Salem is right on both accounts. A possible one-liner:
This uses the pointer to c-strings as iterator, which can be used for the vector constructor.Code:std::vector<std::string> strings(cstrings, cstrings + num_cstrings);