PDA

View Full Version : a simple question:about 'out'



weixj2003ld
17th July 2020, 13:24
I want to output two results in a function,so I define it as follows:

bool getData(out QList<float> A,out QList<float> B)
{
}

but error occur:
error C2061: syntax error : identifier'out'.
How to define 'out' para in a funtion?
thank you.

d_stranz
17th July 2020, 20:24
bool getData(out QList<float> A,out QList<float> B)

Open your book, find out why this is not valid C++ syntax.

Usually, if you want to pass in a variable that you will assign inside a function, you use either a reference or a pointer:



bool getData( QList<float> & A, QList<float> & B )

// or

bool getData( QList<float> * A, QList<float> * B )