Vector array
Is there something wrong with this:
1 2 3 4
|
#include <vector>;
using namespace std;
vector<int> g1p1(261,35,243,240,445,24,297,148,298,95);
|
?
My compiler says:
error: no matching function for call to 'std::vector<int, std::allocator
<int> >::vector(int, int, int, int, int, int, int, int, int, int)'
note: candidates are: std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc
>&) [with _Tp = int, _Alloc = std::allocator<int>]
TYVM
Is there something wrong with this: |
Yes there is, as you can see even the compiler told you that.
Possible solution:
1 2
|
int tmp[] = {261,35,243,240,445,24,297,148,298,95};
vector<int> g1p1(tmp, tmp+10);
|
Thanks R0mai.
So do I have to use two arrays (1 "normal" and one vector) to add my numbers?
Last edited on
Topic archived. No new replies allowed.