Vector array
Aug 30, 2010 at 10:25pm
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
Aug 30, 2010 at 10:37pm
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);
|
Aug 30, 2010 at 10:40pm
Thanks R0mai.
So do I have to use two arrays (1 "normal" and one vector) to add my numbers?
Aug 31, 2010 at 11:09am
Last edited on Aug 31, 2010 at 11:09am
Topic archived. No new replies allowed.