如何使用boost将vector <pair <double,double =“” >>连接到字符串?

时间:2019-03-22 14:37:37

标签: c++ boost

我相信我可以做到以下几点:

vector<string> coordinates;
vector<pair<double, double>> xy;
for (auto p : xy) {
    coordinates.emplace(to_string(p.first));
    coordinates.emplace(to_string(p.second));
}
string str = boost::join(coordinates, ' ');

有什么方法可以避免创建vector<> xy的中间步骤?

0 个答案:

没有答案