【发布时间】:2017-09-09 21:07:55
【问题描述】:
我看到一个函数引用了一个 std::vector,传递给它的参数让我对正在发生的事情感到困惑。它看起来像这样:
void aFunction(const std::vector<int>& arg) { }
int main()
{
aFunction({ 5, 6, 4 }); // Curly brace initialisation? Converting constructor?
std::vector<int> arr({ 5, 6, 4 }); // Also here, I can't understand which of the constructors it's calling
return 0;
}
谢谢。
【问题讨论】:
标签: c++ c++11 vector constructor