相关疑难解决方法(0)

将std :: string转换为std :: vector <char>

我使用的接收数据作为图书馆vectorchar秒.我需要传递string给图书馆.

我想使用std::vector接受迭代器的构造函数来执行转换 - 但是想知道是否有更好的方法呢?

/*Note: json_str is of type std::string*/
const std::vector<char> charvect(json_str.begin(), json_str.end()); 
Run Code Online (Sandbox Code Playgroud)

c++

41
推荐指数
2
解决办法
4万
查看次数

标签 统计

c++ ×1