小编Yuc*_*oat的帖子

我喜欢c.vim插件,但我不使用K&R代码风格

当我编写代码时,我想使用ANSI C样式,但c.vim模板中的代码样式是K&R.

我在哪里可以获得另一个模板或任何其他插件而不是c.vim

c vim plugins

7
推荐指数
1
解决办法
1393
查看次数

push_back矢量到另一个向量

我想要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)

c++ stl vector

6
推荐指数
3
解决办法
2万
查看次数

标签 统计

c ×1

c++ ×1

plugins ×1

stl ×1

vector ×1

vim ×1