当我编写代码时,我想使用ANSI C样式,但c.vim模板中的代码样式是K&R.
我在哪里可以获得另一个模板或任何其他插件而不是c.vim?
我想要push_back()一个矢量M到矢量N.
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int i = -1;
vector<vector<int> >N,
vector<int>M;
int temp;
while (i++ != 5)
{
cin >> temp;
N.push_back(temp);
}
N.push_back(vector<int>M);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我收到语法错误.
test.cpp: In function ‘int main()’:
test.cpp:28: error: invalid declarator before ‘M’
test.cpp:34: error: no matching function for call to ‘std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >::push_back(int&)’
/usr/include/c++/4.4/bits/stl_vector.h:733: note: candidates are: void std::vector<_Tp, _Alloc>::push_back(const _Tp&) [with _Tp = …Run Code Online (Sandbox Code Playgroud)