我相信我可以做到以下几点:
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
的中间步骤?