I have a problem understanding the behavior of QList.
#include <QList> #include <iostream> using namespace std; int main() { QList<double> *myList; myList = new QList<double>; double myNumber; double ABC; for (int i=0; i<1000000; i++) { myNumber = i; myList->append(myNumber); ABC = myList[i]; //<----------!!!!!!!!!!!!!!!!!!! cout << ABC << endl; } cout << "Done!" << endl; return 0; }
I get a compilation error cannot convert 'QList to' double in assignment in the marked line. It works when I use ABC = myList.at(i) , but the QT link seems to say that the at() and [] operator are the same. Does anyone know what the difference is?
thanks
c ++ qt qt4 qlist
Moomin
source share