Frage

I'm trying to declare a vector of vectors with STL template class vector, but I don't know what I'm doing wrong.

int K = 4;
int clusterSize = 45;    
vector<vector<double> > clusters(K+1,vector<double>(clusterSize));

It throws me this error:

warning C4244: 'argument' : conversion from 'double' to 'unsigned int', possible loss of data   

What am I doing wrong?

Thanks!

War es hilfreich?

Lösung

When compiled with C++Builder XE3, Windows 64-bit compiler, based on Clang 3.1, there are two warnings, but stating the same information: implicit conversion changes signedness: 'int' to 'size_type' (aka 'unsigned long long'). The warnings are at the K+1 and clusterSize locations in the declaration of clusters.

Whatever compiler is being used is trying to convey something similar about how an int is used instead of size_type. Review this excellent vector reference for more constructor details: std::vector::vector.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top