asyncfuture
asyncfuture copied to clipboard
Unable to create a AsyncFuture::Deferred<QList<T>>
This is a very handy library - thank you. But: Consider this function:
QFuture<QList<double>> foo() {
AsyncFuture::Deferred<QList<double>> _terrain_fetched;
_terrain_fetched.complete(QList<double>());
return _terrain_fetched.future();
}
and the compiler error:
In file included from ../foo.h:7,
from ../foo.cpp:4:
../AirBoss-MissionPlanner/src/SmartMissionPlanner/AsyncFuture.h: In instantiation of ‘void AsyncFuture::Private::DeferredFuture<T>::reportResult(QList<R>&) [with R = double; T = QList<double>]’:
../AirBoss-MissionPlanner/src/SmartMissionPlanner/AsyncFuture.h:505:9: required from ‘void AsyncFuture::Private::DeferredFuture<T>::complete(QList<R>&) [with R = double; T = QList<double>]’
../AirBoss-MissionPlanner/src/SmartMissionPlanner/AsyncFuture.h:1280:9: required from ‘void AsyncFuture::Deferred<T>::complete(T) [with T = QList<double>]’
../foo.cpp:78:46: required from here
../AirBoss-MissionPlanner/src/SmartMissionPlanner/AsyncFuture.h:661:46: error: no matching function for call to ‘AsyncFuture::Private::DeferredFuture<QList<double> >::reportResult(double&, int&)’
QFutureInterface<T>::reportResult(value[i], i);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
In file included from ../../../Qt5.12.5/5.12.5/gcc_64/include/QtCore/qfuture.h:45,
from ../../../Qt5.12.5/5.12.5/gcc_64/include/QtCore/QtCore:85,
from ../../../Qt5.12.5/5.12.5/gcc_64/include/QtConcurrent/QtConcurrentDepends:3,
from ../../../Qt5.12.5/5.12.5/gcc_64/include/QtConcurrent/QtConcurrent:3,
from ../foo.cpp:1:
../../../Qt5.12.5/5.12.5/gcc_64/include/QtCore/qfutureinterface.h:189:13: note: candidate: ‘void QFutureInterface<T>::reportResult(const T*, int) [with T = QList<double>]’
inline void QFutureInterface<T>::reportResult(const T *result, int index)
^~~~~~~~~~~~~~~~~~~
../../../Qt5.12.5/5.12.5/gcc_64/include/QtCore/qfutureinterface.h:189:13: note: no known conversion for argument 1 from ‘double’ to ‘const QList<double>*’
../../../Qt5.12.5/5.12.5/gcc_64/include/QtCore/qfutureinterface.h:209:13: note: candidate: ‘void QFutureInterface<T>::reportResult(const T&, int) [with T = QList<double>]’
inline void QFutureInterface<T>::reportResult(const T &result, int index)
^~~~~~~~~~~~~~~~~~~
../../../Qt5.12.5/5.12.5/gcc_64/include/QtCore/qfutureinterface.h:209:13: note: no known conversion for argument 1 from ‘double’ to ‘const QList<double>&’
../foo.cpp:43:40: warning: ‘airmap::geography::bounding_box fromQt(const QGeoRectangle&)’ defined but not used [-Wunused-function]
static airmap::geography::bounding_box fromQt(const QGeoRectangle& bbox) {
for some reason the compiler prefers to match this instead of this.
This is due to template resolution. Use a QVector instead of a QList.
- Using a QList or no container, your future will contain multiple results.
- Using a QVector, your future will contain a single result, e.g. the QVector that contains all further results.
This is due to template resolution. Use a QVector instead of a QList.
* Using a QList or no container, your future will contain multiple results. * Using a QVector, your future will contain a single result, e.g. the QVector that contains all further results.
As of Qt6, QVector is now an alias for QList, so this error pops no matter which one you use.
This is due to template resolution. Use a QVector instead of a QList.
* Using a QList or no container, your future will contain multiple results. * Using a QVector, your future will contain a single result, e.g. the QVector that contains all further results.
As of Qt6, QVector is now an alias for QList, so this error pops no matter which one you use.
This is a breaking change for me (at least, it is as of today because I've tried to use it with a Future holding a QVector
Is this an issue on the current master? This repository is currently maintained on https://github.com/vpicaver/asyncfuture
Yes, it should be raised there.
On Wed, 25 Oct 2023, 15:45 Philip Schuchardt, @.***> wrote:
Is this an issue on the current master? This repository is currently maintained on https://github.com/vpicaver/asyncfuture
— Reply to this email directly, view it on GitHub https://github.com/benlau/asyncfuture/issues/23#issuecomment-1779445120, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHSGJTJ4OKCTZO4QNGF3ELYBEQ2DAVCNFSM4JSHLOX2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCNZXHE2DINJRGIYA . You are receiving this because you commented.Message ID: @.***>
@remster Do you think you could close this issue. It has been fixed in https://github.com/vpicaver/asyncfuture/commit/900e4a24e04ebe4894f2ac860c2b4ee7b9f7140a