编译器对std::vector<std::string&>
而且我不明白为什么这是非法的
#include <vector>
#include <iostream>
std::string makeSetence(std::vector<std::string&> v) {
std::string result;
for (int i = 0; i < v.size(); i++) {
auto w = v.at(i);
result += w;
if (i == v.size() - 1) {
continue;
}
result += " ";
}
return result;
}
int main() {
std::vector<std::string&> v;
std::string test1 = "hello";
v.push_back(test1);
std::cout << makeSetence(v) << std::endl;
return 0;
}