diff --git a/README.md b/README.md index b3cbda7..ce7efea 100644 --- a/README.md +++ b/README.md @@ -385,9 +385,11 @@ QPromise compute(const QString& type) } ``` -### `[static] QPromise::all(QVector>) -> QPromise>` +### `[static] QPromise::all(Sequence>) -> QPromise>` Returns a `QPromise>` that fulfills when **all** `promises` of (the same) type `T` have been fulfilled. The `output` value is a vector containing **all** the values of `promises`, in the same order. If any of the given `promises` fail, `output` immediately rejects with the error of the promise that rejected, whether or not the other promises are resolved. +`Sequence` is any STL compatible container (eg. `QVector`, `QList`, `std::vector`, etc.) + ```cpp QVector > promises{ download(QUrl("http://a...")), @@ -417,7 +419,7 @@ auto promise = qPromise(QString("foo")); // QPromise This method also allows to convert `QFuture` to `QPromise` delayed until the `QFuture` is finished ([read more](#qtconcurrent-convert)). -### `qPromiseAll(QVector promises) -> QPromise>` +### `qPromiseAll(Sequence promises) -> QPromise>` This method simply calls the appropriated [`QPromise::all`](#qpromise-all) static method based on the given `QVector` type. In some cases, this method is more convenient than the static one since it avoid some extra typing: ```cpp diff --git a/src/qtpromise/qpromise.h b/src/qtpromise/qpromise.h index d1c110f..ed7d7c5 100644 --- a/src/qtpromise/qpromise.h +++ b/src/qtpromise/qpromise.h @@ -85,7 +85,9 @@ public: QPromise(F&& resolver): QPromiseBase(std::forward(resolver)) { } public: // STATIC - inline static QPromise > all(const QVector >& promises); + template