preventing complex warning

Hi guys.

In my code I create some complex numbers and I try to manipulate them in something of that sort:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
vector <complex <double> > q;
q.resize(0);

short i = 0
while (i < 8){
/*
 a simple algorithm to generate q initial values usually 0
*/
}

while (true){
short pos = /* a simple method to decide the position in q to update*/
q[pos] = q[pos];
}


note that for now, I don't even try to change the values in q.

When I compile the code I get a warning (I hope I get this right, I'm copying it by hand because of firefox bug on the other machine):

warning: passing 'double' for argument 1 to 'typename std::_Vector_base<Tp._Alloc>::_Tp_alloc_type::reference std::vector<_Tp._Alloc>::operator[](size_t)[with_Tp = std::vector<std::complex<double>,std::allocator<std::complex<double> > >,_Alloc = std::allocator<std::complex<double>,std::allocator<std::complex<double> > > >]'


Thanks for any help.

Yotam
error-warning messages regarding templates are always unreadable. To strip the meaningful part of that message_
warning: passing 'double' to vector<complex<double>>::operator[] ( size_t )

Which means that in your code you have something like q[some_double]
The code above shouldn't give that warning, so the message was referring to something else or you missed something when copied it
Thanks. I wasn't sure what is the meaningful part but I suspected the first. I think I know where my problem is (multiplying by 0.5).
Topic archived. No new replies allowed.