Unsolved function return array
-
Hello ,
who can provide me an example of creating c++ function which return an array .
then I would like to get this array in another class .
thank you -
Hi,
QVector<int> generateStuff() { QVector<int> vector {1, 2, 3}; return vector; }; class SomeClass { void setVector(const QVector<int> &vector); void soSomething(); }; int main(int argc, char **argv) { QVector<int> vector = generateStuff(); SomeClass someClass; someClass.setVector(vector); someClass.doSomething(); return 0; }