[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
not resolving operator []
From: |
Edo |
Subject: |
not resolving operator [] |
Date: |
Sat, 18 Sep 2004 05:11:53 -0700 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6) Gecko/20040113 |
Hello
I don’t know why the code below is giving the message it does when I
(gdb)it.
vector<double> vd;
add few elements to vd
int r = 2;
vector<int> pv;
for(int i = 0; i<= 1; ++i){
int x = static_cast<int> (floor(vd[i]*r));
pv.push_back(x);
}
when the line "pv.push_back(x);" is executed at least once, I am getting
this
(gdb) p pv[0]
One of the arguments you tried to pass to operator[] could not be
converted to what the function wants.
(gdb) p vd[0]
$4 = (double &) @0x80709c8 .273365000000000002
ok, I thought reinterpret_cast<int> instead of static_cast<int> but that
would not even compile.
I am using GNU 6.1-debian
thanks for any suggestions
- not resolving operator [],
Edo <=