[Qt-interest] Array

Yves Bailly yves.bailly at sescoi.fr
Fri Feb 20 10:12:45 CET 2009


Sujan Dasmahapatra wrote:
> If I don’t want to specify the size of an array can I do it ?
> Like
> 
> QPointF  points[];

No you can't. Use either:

std::vector<QPointF> points;
/*...*/
points.resize(nb);

or

QVector<QPointF> points;
/*...*/
points.resize(nb);

or

QVarLengthArray<QPointF, initial_size> points;
/*...*/
points.resize(nb);

or

QPointF* points = 0;
/*...*/
points = new QPointF[nb];
/*...*/
delete[] points;

or

/* Google "C++ dynamic arrays" */

Hope this helps.

-- 
     /- Yves Bailly - Software developper  -\
     \- Sescoi France http://www.sescoi.fr -/
"The possible is done. The impossible is being done. For miracles,
thanks to allow a little delay."





More information about the Qt-interest-old mailing list