-2

In my program QtConcurrent Run does not accept my array of strings or my array of bools. Do I need to convert them into QByteArrays for the data to be passed in?

According to the documentation this works:

extern QString someFunction(const QByteArray &input);

QByteArray bytearray = ...;

QFuture<QString> future = QtConcurrent::run(someFunction, bytearray);
...
QString result = future.result();

In my program this does not work:

extern void test(string args[]);
string args[7]={"blue"};
QFuture<void> future = QtConcurrent::run(test, args);

Error: C2075-- array initialization requires a brace-enclosed initializer list

BDD
  • 25
  • 1
  • 6

1 Answers1

0

Never use C-Style Arrays in QtConcurrent::run. Use C++ std::array instead. Thank you Jesper Juhl!

BDD
  • 25
  • 1
  • 6