compilation error in cpp vector
int main()
{
vector<vector<int>> arr
{
{1, 2, 3},
{4, 5, 6},
{7, 8, 9}
};
/* output */
for (int i = 0; i < arr.size(); i++)
{
for (int j = 0; j < arr[0].size(); j++)
{
cout << arr[i][j] << " ";
}
cout << "\n";
}
}
ERROR:
error: non-aggregate type 'vector<vector<int> >' cannot be initialized with an initializer list
vector<vector<int>> arr {
clang++ --version:
Apple clang version 13.1.6 (clang-1316.0.21.2)
Target: arm64-apple-darwin21.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin