0
我有一个带有const char*[2]
参数的Visual Studio 2008 C++应用程序,我想将其转换为std::pair< std::string, std::string >
。有没有简单的方法来做到这一点?从const char * [2]转换为pair <string,string>
例如:
typedef std::pair< std::string, std::string > Group;
const char* a[ 2 ] = { "buzz", "foo" };
Group z = a; // ???
// a->first.c_str() == "buzz"
// a->second.c_str() == "foo"
感谢, PaulH
'pair'没有任何阵列/迭代器/范围构造器,所以这可能是最好的答案。 – aschepler 2010-12-16 19:45:42