Skip to content
This repository has been archived by the owner on Dec 12, 2023. It is now read-only.
This repository has been archived by the owner on Dec 12, 2023. It is now read-only.

Unable to create a AsyncFuture::Deferred<QList<T>> #23

Open
@remster

Description

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.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions