试了一下,有个报错
C:\Users\J.Geng\Desktop\coro\qtnetworkng\include\coroutine_utils.h:87: error: no matching function for call to 'QObject::connect(const QNetworkReply*&, void (QNetworkReply::* const&)(), qtng::qAwait(const Obj*, typename QtPrivate::FunctionPointer<void (Obj::*)()>::Function) [with Obj = QNetworkReply; typename QtPrivate::FunctionPointer<void (Obj::*)()>::Function = void (QNetworkReply::*)()]::<lambda()>, Qt::ConnectionType)'
In file included from ..\using_iodevice\../../include/qtnetworkng.h:9,
from ..\using_iodevice\../../qtnetworkng.h:1,
from ..\using_iodevice\main.cpp:6:
..\using_iodevice\../../include/coroutine_utils.h: In instantiation of 'void qtng::qAwait(const Obj*, typename QtPrivate::FunctionPointer<void (Obj::*)()>::Function) [with Obj = QNetworkReply; typename QtPrivate::FunctionPointer<void (Obj::*)()>::Function = void (QNetworkReply::*)()]':
..\using_iodevice\main.cpp:21:47: required from here
..\using_iodevice\../../include/coroutine_utils.h:87:45: error: no matching function for call to 'QObject::connect(const QNetworkReply*&, void (QNetworkReply::* const&)(), qtng::qAwait(const Obj*, typename QtPrivate::FunctionPointer<void (Obj::*)()>::Function) [with Obj = QNetworkReply; typename QtPrivate::FunctionPointer<void (Obj::*)()>::Function = void (QNetworkReply::*)()]::<lambda()>, Qt::ConnectionType)'
const auto connection = QObject::connect(obj, signal, [event] () {
~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
event->set();
~~~~~~~~~~~~~
}, Qt::DirectConnection);
~~~~~~~~~~~~~~~~~~~~~~~~
Qt 5.15.1 MingW8.1
【 在 hgoldfish 的大作中提到: 】
: 我写的啊。。目前 Qt 底下唯一的 coroutine 库。
:
https://qtng.org/: 可惜没时间移植到 stl,不然就是 c++ 底下最易用的 coroutine 库了。
: ...................
--
FROM 123.123.131.*