将一个以null结尾的const char*字符串数组转换为std :: vector <std :: string>

Pau*_*ulH 11 c++ string stl vector

我有一个Visual Studio 2008 C++函数,我给出了一个以null结尾的字符串数组和该数组中字符串const char*数的计数.

我正在寻找一种巧妙的方法来将数组转换const char*为astd::vector< std::string >

/// @param count - number of strings in the array
/// @param array - array of null-terminated strings
/// @return - a vector of stl strings
std::vector< std::string > Convert( int count, const char* array[] );
Run Code Online (Sandbox Code Playgroud)

提升很好,STL很好.

谢谢,PaulH

gen*_*ult 14

像这样的东西?:

vector< string > ret( array, array + count );
Run Code Online (Sandbox Code Playgroud)