-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
qcoro: update to v0.10.0, add workaround for MSVC ABI issue
- Loading branch information
Showing
5 changed files
with
90 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
sources: | ||
"0.4.0": | ||
url: "https://github.com/danvratil/qcoro/archive/refs/tags/v0.4.0.tar.gz" | ||
sha256: "0e68b3f0ce7bf521ffbdd731464d2d60d8d7a39a749b551ed26855a1707d86d1" | ||
"0.10.0": | ||
url: "https://github.com/danvratil/qcoro/archive/refs/tags/v0.10.0.tar.gz" | ||
sha256: "b7c8f00273ad27d85814bf4ec93eb6922c75656800a61d11854d36355a4a1aec" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,12 @@ | ||
// SPDX-FileCopyrightText: 2021 Daniel Vrátil <[email protected]> | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
#include "qcorofuture.h" | ||
|
||
#include <QCoreApplication> | ||
#include <QTimer> | ||
#include <qcorofuture.h> | ||
#include <QtConcurrent> | ||
|
||
#include <iostream> | ||
#include <random> | ||
|
||
QCoro::Task<> startTask() { | ||
const auto data = co_await QtConcurrent::run([]() { | ||
QVector<std::uint64_t> data; | ||
std::random_device rd{}; | ||
std::mt19937 gen{rd()}; | ||
data.reserve(10'000'000); | ||
for (int i = 0; i < 10'000'000; ++i) { | ||
data.push_back(gen()); | ||
} | ||
return data; | ||
return 0; | ||
}); | ||
|
||
std::cout << "Generated " << data.size() << " random numbers" << std::endl; | ||
|
||
const auto sum = co_await QtConcurrent::filteredReduced<std::uint64_t>( | ||
data, [](const auto &) { return true; }, | ||
[](std::uint64_t &interm, std::uint64_t val) { interm += val; }, | ||
QtConcurrent::UnorderedReduce); | ||
|
||
std::cout << "Calculated result: " << sum << std::endl; | ||
qApp->quit(); | ||
} | ||
|
||
int main(int argc, char **argv) { | ||
QCoreApplication app(argc, argv); | ||
QTimer::singleShot(0, startTask); | ||
return app.exec(); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
versions: | ||
"0.4.0": | ||
"0.10.0": | ||
folder: all |