このページでは

QtConcurrent Namespace

QtConcurrent 名前空間は、低レベルのスレッド処理プリミティブを使用せずにマルチスレッドプログラムを作成できる、高レベルの API を提供します。詳細...

ヘッダー: #include <QtConcurrent>
CMake: find_package(Qt6 REQUIRED COMPONENTS Concurrent)
target_link_libraries(mytarget PRIVATE Qt6::Concurrent)
qmake: QT += concurrent

クラス

(since 6.0) class QTaskBuilder

型

enum class FutureResult { Ignore }
InvokeResultType
enum ReduceOption { UnorderedReduce, OrderedReduce, SequentialReduce }
flags ReduceOptions

関数

void blockingFilter(Sequence &sequence, KeepFunctor &&filterFunction)
void blockingFilter(QThreadPool *pool, Sequence &sequence, KeepFunctor &&filterFunction)
std::decay_t<Sequence> blockingFiltered(Sequence &&sequence, KeepFunctor &&filterFunction)
OutputSequence blockingFiltered(Iterator begin, Iterator end, KeepFunctor &&filterFunction)
std::decay_t<Sequence> blockingFiltered(QThreadPool *pool, Sequence &&sequence, KeepFunctor &&filterFunction)
OutputSequence blockingFiltered(QThreadPool *pool, Iterator begin, Iterator end, KeepFunctor &&filterFunction)
ResultType blockingFilteredReduced(Sequence &&sequence, KeepFunctor &&filterFunction, ReduceFunctor &&reduceFunction, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))
ResultType blockingFilteredReduced(Iterator begin, Iterator end, KeepFunctor &&filterFunction, ReduceFunctor &&reduceFunction, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))
ResultType blockingFilteredReduced(QThreadPool *pool, Sequence &&sequence, KeepFunctor &&filterFunction, ReduceFunctor &&reduceFunction, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))
ResultType blockingFilteredReduced(Sequence &&sequence, KeepFunctor &&filterFunction, ReduceFunctor &&reduceFunction, InitialValueType &&initialValue, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))
ResultType blockingFilteredReduced(Iterator begin, Iterator end, KeepFunctor &&filterFunction, ReduceFunctor &&reduceFunction, InitialValueType &&initialValue, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))
ResultType blockingFilteredReduced(QThreadPool *pool, Iterator begin, Iterator end, KeepFunctor &&filterFunction, ReduceFunctor &&reduceFunction, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))
ResultType blockingFilteredReduced(QThreadPool *pool, Sequence &&sequence, KeepFunctor &&filterFunction, ReduceFunctor &&reduceFunction, InitialValueType &&initialValue, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))
ResultType blockingFilteredReduced(QThreadPool *pool, Iterator begin, Iterator end, KeepFunctor &&filterFunction, ReduceFunctor &&reduceFunction, InitialValueType &&initialValue, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))
void blockingMap(Sequence &&sequence, MapFunctor &&function)
void blockingMap(Iterator begin, Iterator end, MapFunctor &&function)
void blockingMap(QThreadPool *pool, Sequence &&sequence, MapFunctor function)
void blockingMap(QThreadPool *pool, Iterator begin, Iterator end, MapFunctor &&function)
OutputSequence blockingMapped(InputSequence &&sequence, MapFunctor &&function)
Sequence blockingMapped(Iterator begin, Iterator end, MapFunctor &&function)
OutputSequence blockingMapped(QThreadPool *pool, InputSequence &&sequence, MapFunctor &&function)
Sequence blockingMapped(QThreadPool *pool, Iterator begin, Iterator end, MapFunctor &&function)
ResultType blockingMappedReduced(Sequence &&sequence, MapFunctor &&mapFunction, ReduceFunctor &&reduceFunction, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))
ResultType blockingMappedReduced(Iterator begin, Iterator end, MapFunctor &&mapFunction, ReduceFunctor &&reduceFunction, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))
ResultType blockingMappedReduced(QThreadPool *pool, Sequence &&sequence, MapFunctor &&mapFunction, ReduceFunctor &&reduceFunction, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))
ResultType blockingMappedReduced(Sequence &&sequence, MapFunctor &&mapFunction, ReduceFunctor &&reduceFunction, InitialValueType &&initialValue, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))
ResultType blockingMappedReduced(Iterator begin, Iterator end, MapFunctor &&mapFunction, ReduceFunctor &&reduceFunction, InitialValueType &&initialValue, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))
ResultType blockingMappedReduced(QThreadPool *pool, Iterator begin, Iterator end, MapFunctor &&mapFunction, ReduceFunctor &&reduceFunction, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))
ResultType blockingMappedReduced(QThreadPool *pool, Sequence &&sequence, MapFunctor &&mapFunction, ReduceFunctor &&reduceFunction, InitialValueType &&initialValue, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))
ResultType blockingMappedReduced(QThreadPool *pool, Iterator begin, Iterator end, MapFunctor &&mapFunction, ReduceFunctor &&reduceFunction, InitialValueType &&initialValue, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))
QFuture<void> filter(Sequence &sequence, KeepFunctor &&filterFunction)
QFuture<void> filter(QThreadPool *pool, Sequence &sequence, KeepFunctor &&filterFunction)
QFuture<typename std::decay_t<Sequence>::value_type> filtered(Sequence &&sequence, KeepFunctor &&filterFunction)
QFuture<typename qValueType<Iterator>::value_type> filtered(Iterator begin, Iterator end, KeepFunctor &&filterFunction)
QFuture<typename std::decay_t<Sequence>::value_type> filtered(QThreadPool *pool, Sequence &&sequence, KeepFunctor &&filterFunction)
QFuture<typename qValueType<Iterator>::value_type> filtered(QThreadPool *pool, Iterator begin, Iterator end, KeepFunctor &&filterFunction)
QFuture<ResultType> filteredReduced(Sequence &&sequence, KeepFunctor &&filterFunction, ReduceFunctor &&reduceFunction, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))
QFuture<ResultType> filteredReduced(Iterator begin, Iterator end, KeepFunctor &&filterFunction, ReduceFunctor &&reduceFunction, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))
QFuture<ResultType> filteredReduced(QThreadPool *pool, Sequence &&sequence, KeepFunctor &&filterFunction, ReduceFunctor &&reduceFunction, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))
QFuture<ResultType> filteredReduced(Sequence &&sequence, KeepFunctor &&filterFunction, ReduceFunctor &&reduceFunction, InitialValueType &&initialValue, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))
QFuture<ResultType> filteredReduced(Iterator begin, Iterator end, KeepFunctor &&filterFunction, ReduceFunctor &&reduceFunction, InitialValueType &&initialValue, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))
QFuture<ResultType> filteredReduced(QThreadPool *pool, Iterator begin, Iterator end, KeepFunctor &&filterFunction, ReduceFunctor &&reduceFunction, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))
QFuture<ResultType> filteredReduced(QThreadPool *pool, Sequence &&sequence, KeepFunctor &&filterFunction, ReduceFunctor &&reduceFunction, InitialValueType &&initialValue, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))
QFuture<ResultType> filteredReduced(QThreadPool *pool, Iterator begin, Iterator end, KeepFunctor &&filterFunction, ReduceFunctor &&reduceFunction, InitialValueType &&initialValue, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))
QFuture<void> map(Sequence &&sequence, MapFunctor &&function)
QFuture<void> map(Iterator begin, Iterator end, MapFunctor &&function)
QFuture<void> map(QThreadPool *pool, Sequence &&sequence, MapFunctor &&function)
QFuture<void> map(QThreadPool *pool, Iterator begin, Iterator end, MapFunctor &&function)
QFuture<QtPrivate::MapResultType<Sequence, MapFunctor>> mapped(Sequence &&sequence, MapFunctor &&function)
QFuture<QtPrivate::MapResultType<Iterator, MapFunctor>> mapped(Iterator begin, Iterator end, MapFunctor &&function)
QFuture<QtPrivate::MapResultType<Sequence, MapFunctor>> mapped(QThreadPool *pool, Sequence &&sequence, MapFunctor &&function)
QFuture<QtPrivate::MapResultType<Iterator, MapFunctor>> mapped(QThreadPool *pool, Iterator begin, Iterator end, MapFunctor &&function)
QFuture<ResultType> mappedReduced(Sequence &&sequence, MapFunctor &&mapFunction, ReduceFunctor &&reduceFunction, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))
QFuture<ResultType> mappedReduced(Iterator begin, Iterator end, MapFunctor &&mapFunction, ReduceFunctor &&reduceFunction, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))
QFuture<ResultType> mappedReduced(QThreadPool *pool, Sequence &&sequence, MapFunctor &&mapFunction, ReduceFunctor &&reduceFunction, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))
QFuture<ResultType> mappedReduced(Sequence &&sequence, MapFunctor &&mapFunction, ReduceFunctor &&reduceFunction, InitialValueType &&initialValue, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))
QFuture<ResultType> mappedReduced(Iterator begin, Iterator end, MapFunctor &&mapFunction, ReduceFunctor &&reduceFunction, InitialValueType &&initialValue, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))
QFuture<ResultType> mappedReduced(QThreadPool *pool, Iterator begin, Iterator end, MapFunctor &&mapFunction, ReduceFunctor &&reduceFunction, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))
QFuture<ResultType> mappedReduced(QThreadPool *pool, Sequence &&sequence, MapFunctor &&mapFunction, ReduceFunctor &&reduceFunction, InitialValueType &&initialValue, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))
QFuture<ResultType> mappedReduced(QThreadPool *pool, Iterator begin, Iterator end, MapFunctor &&mapFunction, ReduceFunctor &&reduceFunction, InitialValueType &&initialValue, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))
QFuture<T> run(Function function, ...)
QFuture<T> run(QThreadPool *pool, Function function, ...)
(since 6.0) QtConcurrent::QTaskBuilder<Task> task(Task &&task)

詳細な説明

利用可能な関数の概要については、 Qt Concurrent モジュールのドキュメントを参照して利用可能な関数の概要を確認するか、各関数の詳細については以下を参照してください。

インクルードの最適化

<QtConcurrent> ヘッダーをインクルードすると、Qt Concurrent モジュール全体とQt Core モジュール全体がインクルードされるため、コンパイル時間やバイナリサイズが増加する可能性があります。QtConcurrent名前空間の個々の関数を使用するには、より具体的なヘッダーをインクルードしてください。

以下の表に、QtConcurrent名前空間の関数と、それに対応するヘッダーを一覧で示します:

関数ヘッダー
QtConcurrent::run()<QtConcurrentRun>
QtConcurrent::task()<QtConcurrentTask>
QtConcurrent::filter(),QtConcurrent::filtered(),QtConcurrent::filteredReduced()<QtConcurrentFilter>
QtConcurrent::map(),QtConcurrent::mapped(),QtConcurrent::mappedReduced()<QtConcurrentMap>

クラス

classQTaskBuilder

QTaskBuilder クラスは、タスクのパラメータを調整するために使用されます。詳細...

型のドキュメント

enum class QtConcurrent::FutureResult

この列挙型は、フューチャーオブジェクトを返さないQtConcurrent::QTaskBuilder::spawn (QtConcurrent::FutureResult)の特別なオーバーロードを呼び出すために使用されます。

定数値説明
QtConcurrent::FutureResult::Ignore0コードの可読性を向上させるために導入された補助的なタグです。

[alias] InvokeResultType

この型の簡略化された定義は、次のようになります。

template <class Task, class ...Args>
using InvokeResultType = std::invoke_result_t<std::decay_t<Task>, std::decay_t<Args>...>;

実際の実装では、指定された引数でタスクを呼び出せるかどうかをコンパイル時にチェックする処理も含まれています。

enum QtConcurrent::ReduceOption
flags QtConcurrent::ReduceOptions

この列挙型は、map 関数または filter 関数の結果が reduce 関数に渡される順序を指定します。

定数値説明
QtConcurrent::UnorderedReduce0x1リダクションは任意の順序で行われます。
QtConcurrent::OrderedReduce0x2元のシーケンスの順序に従ってリダクションが行われます。
QtConcurrent::SequentialReduce0x4リダクションは順次実行されます。つまり、一度に 1 つのスレッドのみが reduce 関数に入ります。(Qt Concurrent の将来のバージョンでは、並列リダクションがサポートされる可能性があります。)

`ReduceOptions` 型は、`QFlags<ReduceOption>` の typedef です。これは、`ReduceOption` 値の論理和(OR)を格納します。

関数のドキュメント

template <typename Sequence, typename KeepFunctor> void QtConcurrent::blockingFilter(Sequence &sequence, KeepFunctor &&filterFunction)

sequence 内の各要素について、filterFunction を1回ずつ呼び出します。filterFunction がtrue を返した場合、その要素はsequence に残されます。そうでない場合、その要素はsequence から削除されます。

なお、このメソッドにはイテレータを扱うオーバーロードは存在しません。これは、操作対象のシーケンスのイテレータを無効にしてしまうためです。

注:この関数は 、シーケンス内のすべての項目が処理されるまでブロックします。

「Concurrent Filter」および「Filter-Reduce」も参照してください 。

template <typename Sequence, typename KeepFunctor> void QtConcurrent::blockingFilter(QThreadPool *pool, Sequence &sequence, KeepFunctor &&filterFunction)

sequence に含まれる各アイテムについて、filterFunction を1回呼び出します。filterFunction へのすべての呼び出しは、QThreadPool pool から取得したスレッドから実行されます。filterFunction がtrue を返した場合、そのアイテムはsequence に保持されます。そうでない場合、そのアイテムはsequence から削除されます。

なお、このメソッドにはイテレータを扱うオーバーロードは存在しません。これは、このメソッドが操作対象のシーケンスのイテレータを無効にしてしまうためです。

注:この関数は 、シーケンス内のすべての項目が処理されるまでブロックします。

「Concurrent Filter」および「Filter-Reduce」も参照してください 。

template <typename Sequence, typename KeepFunctor> std::decay_t<Sequence> QtConcurrent::blockingFiltered(Sequence &&sequence, KeepFunctor &&filterFunction)

sequence に含まれる各アイテムについて、filterFunction を1回ずつ呼び出し、保持されたアイテムの新しいSequenceを返します。filterFunction がtrue を返した場合、そのアイテムのコピーが新しいSequenceに追加されます。それ以外の場合は、そのアイテムは新しいSequenceには含まれません。

注:この関数は 、シーケンス内のすべての項目が処理されるまでブロックします。

関連項目: filtered()、Concurrent Filter、Filter-Reduce。

template < typename OutputSequence, typename Iterator, typename KeepFunctor > OutputSequence QtConcurrent::blockingFiltered(Iterator begin, Iterator end, KeepFunctor &&filterFunction)

begin からend までの各項目について、filterFunction を1回ずつ呼び出し、保持された項目の新しいシーケンスを返します。filterFunction がtrue を返した場合、その項目のコピーが新しいシーケンスに追加されます。それ以外の場合は、その項目は新しいシーケンスに含まれません。

注:この関数は 、イテレータが処理中のシーケンスの末尾に到達するまでブロックします。

関連項目: filtered()、Concurrent Filter、Filter-Reduce。

template <typename Sequence, typename KeepFunctor> std::decay_t<Sequence> QtConcurrent::blockingFiltered(QThreadPool *pool, Sequence &&sequence, KeepFunctor &&filterFunction)

sequence 内の各アイテムについて、filterFunction を1回ずつ呼び出し、保持されたアイテムを含む新しいSequenceを返します。filterFunction へのすべての呼び出しは、QThreadPool pool から取得されたスレッドから実行されます。filterFunction がtrue を返した場合、そのアイテムのコピーが新しいSequenceに格納されます。そうでない場合、そのアイテムは新しいSequenceには含まれません。

注:この関数は 、シーケンス内のすべての項目が処理されるまでブロックされます。

filtered()、Concurrent Filter、および Filter-Reduceも参照してください 。

template < typename OutputSequence, typename Iterator, typename KeepFunctor > OutputSequence QtConcurrent::blockingFiltered(QThreadPool *pool, Iterator begin, Iterator end, KeepFunctor &&filterFunction)

begin からend までの各項目について、filterFunction を 1 回ずつ呼び出し、保持された項目の新しい Sequence を返します。filterFunction へのすべての呼び出しは、QThreadPool pool から取得されたスレッドから実行されます。filterFunction がtrue を返した場合、その項目のコピーが新しい Sequence に追加されます。それ以外の場合、その項目は新しい Sequence に含まれません。

注:この関数は 、イテレータが処理中のシーケンスの末尾に到達するまでブロックします。

関連項目: filtered()、Concurrent Filter、および Filter-Reduce。

template < typename ResultType, typename Sequence, typename KeepFunctor, typename ReduceFunctor > ResultType QtConcurrent::blockingFilteredReduced(Sequence &&sequence, KeepFunctor &&filterFunction, ReduceFunctor &&reduceFunction, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))

sequence 内の各項目について、filterFunction を1回ずつ呼び出します。ある項目に対してfilterFunction がtrue を返した場合、その項目はreduceFunction に渡されます。つまり、戻り値は、filterFunction がtrue を返す各項目について、reduceFunction を実行した結果となります。

なお、filterFunction は並行して呼び出されますが、reduceFunction を呼び出すのは一度に1つのスレッドのみです。reduceOptions がQtConcurrent::UnorderedReduce である場合、reduceFunction が呼び出される順序は未定義です。reduceOptions がQtConcurrent::OrderedReduce である場合、reduceFunction は元のシーケンスの順序で呼び出されます。

注:この関数は 、シーケンス内のすべての項目が処理されるまでブロックされます。

filteredReduced()、およびConcurrent Filter および Filter-Reduceも参照してください 。

template < typename ResultType, typename Iterator, typename KeepFunctor, typename ReduceFunctor > ResultType QtConcurrent::blockingFilteredReduced(Iterator begin, Iterator end, KeepFunctor &&filterFunction, ReduceFunctor &&reduceFunction, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))

begin からend までの各項目について、filterFunction を 1 回ずつ呼び出します。ある項目に対してfilterFunction がtrue を返した場合、その項目はreduceFunction に渡されます。つまり、戻り値は、filterFunction がtrue を返す各項目について、reduceFunction の結果となります。

なお、filterFunction は並行して呼び出されますが、reduceFunction を呼び出すのは一度に1つのスレッドのみです。reduceOptions がQtConcurrent::UnorderedReduce である場合、reduceFunction が呼び出される順序は未定義となります。reduceOptions がQtConcurrent::OrderedReduce である場合、reduceFunction は元のシーケンスの順序で呼び出されます。

注:この関数は 、イテレータが処理中のシーケンスの末尾に到達するまでブロックします。

filteredReduced() およびConcurrent Filter と Filter-Reduceも参照してください 。

template < typename ResultType, typename Sequence, typename KeepFunctor, typename ReduceFunctor > ResultType QtConcurrent::blockingFilteredReduced(QThreadPool *pool, Sequence &&sequence, KeepFunctor &&filterFunction, ReduceFunctor &&reduceFunction, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))

sequence に含まれる各項目について、filterFunction を1回ずつ呼び出します。filterFunction へのすべての呼び出しは、QThreadPool pool から取得されたスレッドから実行されます。filterFunction が項目に対してtrue を返した場合、その項目はreduceFunction に渡されます。つまり、戻り値は、filterFunction がtrue を返す各項目について、reduceFunction を実行した結果となります。

なお、filterFunction は並行して呼び出されますが、reduceFunction を呼び出すのは一度に1つのスレッドのみです。reduceOptions がQtConcurrent::UnorderedReduce である場合、reduceFunction の呼び出し順序は未定義となります。reduceOptions がQtConcurrent::OrderedReduce である場合、reduceFunction は元のシーケンスの順序で呼び出されます。

注:この関数は 、シーケンス内のすべての項目が処理されるまでブロックされます。

filteredReduced()、Concurrent Filter、および Filter-Reduceも参照してください 。

template < typename ResultType, typename Sequence, typename KeepFunctor, typename ReduceFunctor, typename InitialValueType > ResultType QtConcurrent::blockingFilteredReduced(Sequence &&sequence, KeepFunctor &&filterFunction, ReduceFunctor &&reduceFunction, InitialValueType &&initialValue, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))

sequence に含まれる各項目について、filterFunction を1回ずつ呼び出します。filterFunction が特定の項目に対してtrue を返した場合、その項目はreduceFunction に渡されます。つまり、戻り値は、filterFunction がtrue を返す各項目について、reduceFunction が返した結果となります。結果の値は関数が呼び出された時点でinitialValue に初期化され、reduceFunction への最初の呼び出しはこの値に対して行われます。

なお、filterFunction は並行して呼び出されますが、reduceFunction を呼び出すのは一度に1つのスレッドのみです。reduceOptions がQtConcurrent::UnorderedReduce である場合、reduceFunction が呼び出される順序は未定義です。reduceOptions がQtConcurrent::OrderedReduce である場合、reduceFunction は元のシーケンスの順序で呼び出されます。

注:この関数は 、シーケンス内のすべての項目が処理されるまでブロックします。

filteredReduced()、Concurrent Filter、および Filter-Reduceも参照してください 。

template < typename ResultType, typename Iterator, typename KeepFunctor, typename ReduceFunctor, typename InitialValueType > ResultType QtConcurrent::blockingFilteredReduced(Iterator begin, Iterator end, KeepFunctor &&filterFunction, ReduceFunctor &&reduceFunction, InitialValueType &&initialValue, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))

begin からend までの各項目について、filterFunction を 1 回ずつ呼び出します。ある項目に対してfilterFunction がtrue を返した場合、その項目はreduceFunction に渡されます。つまり、戻り値は、filterFunction がtrue を返す各項目について、reduceFunction の結果となります。結果値は関数の呼び出し時にinitialValue に初期化され、reduceFunction への最初の呼び出しはこの値を操作します。

なお、filterFunction は並行して呼び出されますが、reduceFunction を呼び出すのは一度に1つのスレッドのみです。reduceOptions がQtConcurrent::UnorderedReduce である場合、reduceFunction が呼び出される順序は未定義です。reduceOptions がQtConcurrent::OrderedReduce である場合、reduceFunction は元のシーケンスの順序で呼び出されます。

注:この関数は 、イテレータが処理中のシーケンスの末尾に到達するまでブロックします。

filteredReduced() および「並行フィルタ」と「フィルタ・リデュース」も参照してください 。

template < typename ResultType, typename Iterator, typename KeepFunctor, typename ReduceFunctor > ResultType QtConcurrent::blockingFilteredReduced(QThreadPool *pool, Iterator begin, Iterator end, KeepFunctor &&filterFunction, ReduceFunctor &&reduceFunction, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))

begin からend までの各項目について、filterFunction を 1 回ずつ呼び出します。filterFunction へのすべての呼び出しは、QThreadPool (pool )から取得したスレッドから実行されます。filterFunction が特定の項目に対してtrue を返した場合、その項目はreduceFunction に渡されます。つまり、戻り値は、filterFunction がtrue を返す各項目について、reduceFunction の結果となります。

なお、filterFunction は並行して呼び出されますが、reduceFunction を呼び出すのは一度に1つのスレッドのみです。reduceOptions がQtConcurrent::UnorderedReduce である場合、reduceFunction が呼び出される順序は未定義となります。reduceOptions がQtConcurrent::OrderedReduce である場合、reduceFunction は元のシーケンスの順序で呼び出されます。

注:この関数は 、イテレータが処理中のシーケンスの末尾に到達するまでブロックします。

filteredReduced() および「並行フィルタ」と「フィルタ・リデュース」も参照してください 。

template < typename ResultType, typename Sequence, typename KeepFunctor, typename ReduceFunctor, typename InitialValueType > ResultType QtConcurrent::blockingFilteredReduced(QThreadPool *pool, Sequence &&sequence, KeepFunctor &&filterFunction, ReduceFunctor &&reduceFunction, InitialValueType &&initialValue, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))

sequence 内の各項目について、filterFunction を1回ずつ呼び出します。filterFunction へのすべての呼び出しは、QThreadPool のpool から取得されたスレッドから実行されます。filterFunction が項目に対してtrue を返した場合、その項目はreduceFunction に渡されます。つまり、戻り値は、filterFunction がtrue を返す各項目について、reduceFunction の結果となります。結果値は関数が呼び出された際にinitialValue に初期化され、reduceFunction への最初の呼び出しはこの値に対して行われます。

なお、filterFunction は並行して呼び出されますが、reduceFunction を呼び出すのは一度に1つのスレッドのみです。reduceOptions がQtConcurrent::UnorderedReduce の場合、reduceFunction の呼び出し順序は未定義となります。reduceOptions がQtConcurrent::OrderedReduce の場合、reduceFunction は元のシーケンスの順序で呼び出されます。

注:この関数は 、シーケンス内のすべての項目が処理されるまでブロックされます。

filteredReduced()、Concurrent Filter、Filter-Reduceも参照してください 。

template < typename ResultType, typename Iterator, typename KeepFunctor, typename ReduceFunctor, typename InitialValueType > ResultType QtConcurrent::blockingFilteredReduced(QThreadPool *pool, Iterator begin, Iterator end, KeepFunctor &&filterFunction, ReduceFunctor &&reduceFunction, InitialValueType &&initialValue, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))

begin からend までの各項目について、filterFunction を 1 回ずつ呼び出します。filterFunction へのすべての呼び出しは、QThreadPool pool から取得したスレッドから実行されます。filterFunction が項目に対してtrue を返した場合、その項目はreduceFunction に渡されます。つまり、戻り値は、filterFunction がtrue を返す各項目について、reduceFunction の結果となります。 結果値は関数が呼び出された際にinitialValue に初期化され、reduceFunction への最初の呼び出しはこの値に対して行われます。

filterFunction が並行して呼び出される一方で、reduceFunction は一度に 1 つのスレッドのみが呼び出すことに注意してください。reduceOptions がQtConcurrent::UnorderedReduce の場合、reduceFunction が呼び出される順序は未定義です。reduceOptions がQtConcurrent::OrderedReduce の場合、reduceFunction は元のシーケンスの順序で呼び出されます。

注:この関数は 、イテレータが処理中のシーケンスの末尾に到達するまでブロックします。

filteredReduced() およびConcurrent Filter と Filter-Reduceも参照してください 。

template <typename Sequence, typename MapFunctor> void QtConcurrent::blockingMap(Sequence &&sequence, MapFunctor &&function)

sequence 内の各項目について、function を1回ずつ呼び出します。function は項目の参照を受け取るため、その項目に加えられた変更はすべてsequence に反映されます。

注:この関数は 、シーケンス内のすべての項目が処理されるまでブロックされます。

map() および「並行 Map」と「Map-Reduce」も参照してください 。

template <typename Iterator, typename MapFunctor> void QtConcurrent::blockingMap(Iterator begin, Iterator end, MapFunctor &&function)

begin からend までの各項目について、function を 1 回ずつ呼び出します。function は項目の参照を受け取るため、その項目に加えられた変更は、イテレータが属するシーケンスに反映されます。

注:この関数は 、イテレータが処理中のシーケンスの末尾に到達するまでブロックします。

map() および「並行 Map」と「Map-Reduce」も参照してください 。

template <typename Sequence, typename MapFunctor> void QtConcurrent::blockingMap(QThreadPool *pool, Sequence &&sequence, MapFunctor function)

sequence 内の各項目について、function を1回ずつ呼び出します。function へのすべての呼び出しは、QThreadPool pool から取得されたスレッドから実行されます。function は項目の参照を受け取るため、項目に加えられた変更はすべてsequence に反映されます。

注:この関数は 、シーケンス内のすべての項目が処理されるまでブロックされます。

map() および「並列 Map」と「Map-Reduce」も参照してください 。

template <typename Iterator, typename MapFunctor> void QtConcurrent::blockingMap(QThreadPool *pool, Iterator begin, Iterator end, MapFunctor &&function)

begin からend までの各項目について、function を 1 回ずつ呼び出します。function へのすべての呼び出しは、QThreadPool pool から取得したスレッドから実行されます。function は項目の参照を受け取るため、その項目に加えられた変更は、イテレータが属するシーケンスに反映されます。

注:この関数は 、イテレータが処理中のシーケンスの末尾に到達するまでブロックします。

map() および「並行 Map」と「Map-Reduce」も参照してください 。

template < typename OutputSequence, typename InputSequence, typename MapFunctor > OutputSequence QtConcurrent::blockingMapped(InputSequence &&sequence, MapFunctor &&function)

sequence に含まれる各項目について、function を1回ずつ呼び出し、その結果を含むOutputSequenceを返します。結果の型は、MapFunctorによって返される型と一致します。

注:この関数は 、シーケンス内のすべての項目が処理されるまでブロックされます。

mapped()、および「並行 Map」と「Map-Reduce」も参照してください 。

template < typename Sequence, typename Iterator, typename MapFunctor > Sequence QtConcurrent::blockingMapped(Iterator begin, Iterator end, MapFunctor &&function)

begin からend までの各項目について、function を 1 回ずつ呼び出し、その結果を格納したコンテナを返します。コンテナの型は、次のようにテンプレート引数として指定できます。

QList<int> ints = QtConcurrent::blockingMapped<QList<int> >(beginIterator, endIterator, fn);

注:この関数は 、イテレータが処理中のシーケンスの末尾に到達するまでブロックします。

mapped()、および「並行 Map」と「Map-Reduce」も参照してください 。

template < typename OutputSequence, typename InputSequence, typename MapFunctor > OutputSequence QtConcurrent::blockingMapped(QThreadPool *pool, InputSequence &&sequence, MapFunctor &&function)

sequence に含まれる各項目について、function を1回ずつ呼び出し、結果を含むOutputSequenceを返します。function へのすべての呼び出しは、QThreadPool pool から取得されたスレッドから実行されます。結果の型は、MapFunctorによって返される型と一致します。

注:この関数は 、シーケンス内のすべての項目が処理されるまでブロックされます。

mapped() および「並行 Map」と「Map-Reduce」も参照してください 。

template < typename Sequence, typename Iterator, typename MapFunctor > Sequence QtConcurrent::blockingMapped(QThreadPool *pool, Iterator begin, Iterator end, MapFunctor &&function)

begin からend までの各項目について、function を 1 回ずつ呼び出し、結果を含むコンテナを返します。function へのすべての呼び出しは、QThreadPool pool から取得したスレッドから実行されます。コンテナの型は、次のようにテンプレート引数として指定できます。

QList<int> ints = QtConcurrent::blockingMapped<QList<int> >(beginIterator, endIterator, fn);

注:この関数は 、イテレータが処理中のシーケンスの末尾に到達するまでブロックします。

mapped() および「並行 Map」と「Map-Reduce」も参照してください 。

template < typename ResultType, typename Sequence, typename MapFunctor, typename ReduceFunctor > ResultType QtConcurrent::blockingMappedReduced(Sequence &&sequence, MapFunctor &&mapFunction, ReduceFunctor &&reduceFunction, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))

sequence に含まれる各項目について、mapFunction を1回ずつ呼び出します。各mapFunction の戻り値は、reduceFunction に渡されます。

mapFunction は並行して呼び出されますが、reduceFunction を呼び出すスレッドは一度に1つだけであることに注意してください。reduceFunction の呼び出し順序は、reduceOptions によって決定されます。

注:この関数は 、シーケンス内のすべての項目が処理されるまでブロックされます。

関連項目: mapped()、および「並列 Map」と「Map-Reduce」。

template < typename ResultType, typename Iterator, typename MapFunctor, typename ReduceFunctor > ResultType QtConcurrent::blockingMappedReduced(Iterator begin, Iterator end, MapFunctor &&mapFunction, ReduceFunctor &&reduceFunction, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))

begin からend までの各項目について、mapFunction を 1 回ずつ呼び出します。各mapFunction の戻り値は、reduceFunction に渡されます。

mapFunction は並行して呼び出されますが、reduceFunction を呼び出すのは一度に 1 つのスレッドのみであることに注意してください。reduceFunction が呼び出される順序は未定義です。

注:この関数は 、イテレータが処理中のシーケンスの末尾に到達するまでブロックされます。

blockingMappedReduced() および「並行 Map」と「Map-Reduce」も参照してください 。

template < typename ResultType, typename Sequence, typename MapFunctor, typename ReduceFunctor > ResultType QtConcurrent::blockingMappedReduced(QThreadPool *pool, Sequence &&sequence, MapFunctor &&mapFunction, ReduceFunctor &&reduceFunction, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))

sequence 内の各項目について、mapFunction を1回ずつ呼び出します。mapFunction へのすべての呼び出しは、QThreadPool pool から取得したスレッドから実行されます。各mapFunction の戻り値は、reduceFunction に渡されます。

なお、mapFunction は並行して呼び出されますが、reduceFunction を呼び出すスレッドは一度に1つだけです。reduceFunction が呼び出される順序は、reduceOptions によって決定されます。

注:この関数は 、シーケンス内のすべての項目が処理されるまでブロックされます。

関連項目: mapped()、並行 Map、および Map-Reduce。

template < typename ResultType, typename Sequence, typename MapFunctor, typename ReduceFunctor, typename InitialValueType > ResultType QtConcurrent::blockingMappedReduced(Sequence &&sequence, MapFunctor &&mapFunction, ReduceFunctor &&reduceFunction, InitialValueType &&initialValue, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))

sequence に含まれる各項目について、mapFunction を1回ずつ呼び出します。各mapFunction の戻り値は、reduceFunction に渡されます。結果値は関数の呼び出し時にinitialValue に初期化され、reduceFunction への最初の呼び出しはこの値に対して行われます。

なお、mapFunction は並行して呼び出されますが、reduceFunction を呼び出すのは一度に1つのスレッドのみです。reduceFunction が呼び出される順序は、reduceOptions によって決定されます。

注:この関数は 、シーケンス内のすべての項目が処理されるまでブロックします。

関連項目: mapped()、および「並行Map」と「Map-Reduce」。

template < typename ResultType, typename Iterator, typename MapFunctor, typename ReduceFunctor, typename InitialValueType > ResultType QtConcurrent::blockingMappedReduced(Iterator begin, Iterator end, MapFunctor &&mapFunction, ReduceFunctor &&reduceFunction, InitialValueType &&initialValue, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))

begin からend までの各項目について、mapFunction を 1 回ずつ呼び出します。各mapFunction の戻り値は、reduceFunction に渡されます。結果値は関数の呼び出し時にinitialValue に初期化され、reduceFunction への最初の呼び出しはこの値に対して行われます。

なお、mapFunction は並行して呼び出されますが、reduceFunction を呼び出すのは一度に1つのスレッドのみです。reduceFunction が呼び出される順序は未定義です。

注:この関数は 、イテレータが処理中のシーケンスの末尾に到達するまでブロックします。

blockingMappedReduced() および「並行 Map」と「Map-Reduce」も参照してください 。

template < typename ResultType, typename Iterator, typename MapFunctor, typename ReduceFunctor > ResultType QtConcurrent::blockingMappedReduced(QThreadPool *pool, Iterator begin, Iterator end, MapFunctor &&mapFunction, ReduceFunctor &&reduceFunction, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))

begin からend までの各項目について、mapFunction を 1 回ずつ呼び出します。mapFunction へのすべての呼び出しは、QThreadPool pool から取得したスレッドから実行されます。各mapFunction の戻り値は、reduceFunction に渡されます。

なお、mapFunction は並行して呼び出されますが、reduceFunction を呼び出すのは一度に1つのスレッドのみです。reduceFunction が呼び出される順序は未定義です。

注:この関数は 、イテレータが処理中のシーケンスの末尾に到達するまでブロックします。

blockingMappedReduced() および「並行 Map」と「Map-Reduce」も参照してください 。

template < typename ResultType, typename Sequence, typename MapFunctor, typename ReduceFunctor, typename InitialValueType > ResultType QtConcurrent::blockingMappedReduced(QThreadPool *pool, Sequence &&sequence, MapFunctor &&mapFunction, ReduceFunctor &&reduceFunction, InitialValueType &&initialValue, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))

sequence 内の各項目について、mapFunction を1回ずつ呼び出します。mapFunction へのすべての呼び出しは、QThreadPool pool から取得されたスレッドから実行されます。各mapFunction の戻り値は、reduceFunction に渡されます。result値は関数が呼び出された際にinitialValue に初期化され、reduceFunction への最初の呼び出しはこの値に対して行われます。

なお、mapFunction は並行して呼び出されますが、reduceFunction を呼び出すのは一度に1つのスレッドのみです。reduceFunction が呼び出される順序は、reduceOptions によって決定されます。

注:この関数は 、シーケンス内のすべての項目が処理されるまでブロックします。

関連項目: mapped()、および「並行 Map」と「Map-Reduce」。

template < typename ResultType, typename Iterator, typename MapFunctor, typename ReduceFunctor, typename InitialValueType > ResultType QtConcurrent::blockingMappedReduced(QThreadPool *pool, Iterator begin, Iterator end, MapFunctor &&mapFunction, ReduceFunctor &&reduceFunction, InitialValueType &&initialValue, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))

begin からend までの各項目について、mapFunction を 1 回ずつ呼び出します。mapFunction へのすべての呼び出しは、QThreadPool pool から取得されたスレッドから実行されます。各mapFunction の戻り値は、reduceFunction に渡されます。結果値は関数が呼び出された際にinitialValue に初期化され、reduceFunction への最初の呼び出しはこの値に対して処理を行います。

なお、mapFunction は並行して呼び出されますが、reduceFunction を呼び出すのは一度に1つのスレッドのみです。reduceFunction が呼び出される順序は未定義です。

注:この関数は 、イテレータが処理中のシーケンスの末尾に到達するまでブロックします。

blockingMappedReduced() および「並列 Map」と「Map-Reduce」も参照してください 。

template <typename Sequence, typename KeepFunctor> QFuture<void> QtConcurrent::filter(Sequence &sequence, KeepFunctor &&filterFunction)

sequence 内の各要素について、filterFunction を1回ずつ呼び出します。filterFunction がtrue を返した場合、その要素はsequence に残されます。そうでない場合、その要素はsequence から削除されます。

なお、このメソッドにはイテレータを扱うオーバーロードは存在しません。これは、このメソッドが操作対象のシーケンスのイテレータを無効にしてしまうためです。

「Concurrent Filter」および「Filter-Reduce」も参照してください 。

template <typename Sequence, typename KeepFunctor> QFuture<void> QtConcurrent::filter(QThreadPool *pool, Sequence &sequence, KeepFunctor &&filterFunction)

sequence に含まれる各項目について、filterFunction を1回ずつ呼び出します。filterFunction へのすべての呼び出しは、QThreadPool pool から取得したスレッドから実行されます。filterFunction がtrue を返した場合、その項目はsequence に保持されます。そうでない場合、その項目はsequence から削除されます。

なお、このメソッドにはイテレータを扱うオーバーロードは存在しません。これは、操作対象のシーケンスのイテレータを無効にしてしまうためです。

「Concurrent Filter」および「Filter-Reduce」も参照してください 。

template <typename Sequence, typename KeepFunctor> QFuture<typename std::decay_t<Sequence>::value_type> QtConcurrent::filtered(Sequence &&sequence, KeepFunctor &&filterFunction)

sequence に含まれる各項目について、filterFunction を1回ずつ呼び出し、保持された項目からなる新しいSequenceを返します。filterFunction がtrue を返した場合、その項目のコピーが新しいSequenceに追加されます。そうでない場合、その項目は新しいSequenceには含まれません。

「Concurrent Filter」および「Filter-Reduce」も参照してください 。

template <typename Iterator, typename KeepFunctor> QFuture<typename qValueType<Iterator>::value_type> QtConcurrent::filtered(Iterator begin, Iterator end, KeepFunctor &&filterFunction)

begin からend までの各項目について、filterFunction を一度ずつ呼び出し、保持された項目の新しいシーケンスを返します。filterFunction がtrue を返した場合、その項目のコピーが新しいシーケンスに追加されます。そうでない場合、その項目は新しいシーケンスには含まれません。

「Concurrent Filter」および「Filter-Reduce」も参照してください 。

template <typename Sequence, typename KeepFunctor> QFuture<typename std::decay_t<Sequence>::value_type> QtConcurrent::filtered(QThreadPool *pool, Sequence &&sequence, KeepFunctor &&filterFunction)

sequence 内の各アイテムについて、filterFunction を1回呼び出し、保持されたアイテムの新しいSequenceを返します。filterFunction へのすべての呼び出しは、QThreadPool pool から取得されたスレッドから実行されます。filterFunction がtrue を返した場合、そのアイテムのコピーが新しいSequenceに格納されます。そうでない場合、そのアイテムは新しいSequenceには含まれません。

「Concurrent Filter」および「Filter-Reduce」も参照してください 。

template <typename Iterator, typename KeepFunctor> QFuture<typename qValueType<Iterator>::value_type> QtConcurrent::filtered(QThreadPool *pool, Iterator begin, Iterator end, KeepFunctor &&filterFunction)

begin からend までの各項目について、filterFunction を一度ずつ呼び出し、保持された項目の新しい Sequence を返します。filterFunction へのすべての呼び出しは、QThreadPool pool から取得されたスレッドから実行されます。filterFunction がtrue を返した場合、その項目のコピーが新しい Sequence に格納されます。そうでない場合、その項目は新しい Sequence には含まれません。

「Concurrent Filter」および「Filter-Reduce」も参照してください 。

template < typename ResultType, typename Sequence, typename KeepFunctor, typename ReduceFunctor > QFuture<ResultType> QtConcurrent::filteredReduced(Sequence &&sequence, KeepFunctor &&filterFunction, ReduceFunctor &&reduceFunction, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))

sequence に含まれる各項目について、filterFunction を1回ずつ呼び出します。filterFunction が特定の項目に対してtrue を返した場合、その項目はreduceFunction に渡されます。つまり、戻り値は、filterFunction がtrue を返す各項目について、reduceFunction を実行した結果となります。

なお、filterFunction は並行して呼び出されますが、reduceFunction を呼び出すのは一度に1つのスレッドのみです。reduceOptions がQtConcurrent::UnorderedReduce である場合、reduceFunction が呼び出される順序は未定義です。reduceOptions がQtConcurrent::OrderedReduce である場合、reduceFunction は元のシーケンスの順序で呼び出されます。

「Concurrent Filter」および「Filter-Reduce」も参照してください 。

template < typename ResultType, typename Iterator, typename KeepFunctor, typename ReduceFunctor > QFuture<ResultType> QtConcurrent::filteredReduced(Iterator begin, Iterator end, KeepFunctor &&filterFunction, ReduceFunctor &&reduceFunction, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))

begin からend までの各項目について、filterFunction を 1 回ずつ呼び出します。ある項目に対してfilterFunction がtrue を返した場合、その項目はreduceFunction に渡されます。つまり、戻り値は、filterFunction がtrue を返す各項目について、reduceFunction の結果となります。

なお、filterFunction は並行して呼び出されますが、reduceFunction を呼び出すのは一度に1つのスレッドのみです。reduceOptions がQtConcurrent::UnorderedReduce である場合、reduceFunction の呼び出し順序は未定義となります。reduceOptions がQtConcurrent::OrderedReduce である場合、reduceFunction は元のシーケンスの順序で呼び出されます。

「並行フィルタ」および「フィルタ・リデュース」も参照してください 。

template < typename ResultType, typename Sequence, typename KeepFunctor, typename ReduceFunctor > QFuture<ResultType> QtConcurrent::filteredReduced(QThreadPool *pool, Sequence &&sequence, KeepFunctor &&filterFunction, ReduceFunctor &&reduceFunction, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))

sequence 内の各項目について、filterFunction を1回ずつ呼び出します。filterFunction へのすべての呼び出しは、QThreadPool のpool から取得されたスレッドから行われます。filterFunction が特定の項目に対してtrue を返した場合、その項目はreduceFunction に渡されます。つまり、戻り値は、filterFunction がtrue を返す各項目について、reduceFunction の結果となります。

なお、filterFunction は並行して呼び出されますが、reduceFunction を呼び出すのは一度に1つのスレッドのみです。reduceOptions がQtConcurrent::UnorderedReduce の場合、reduceFunction が呼び出される順序は未定義です。reduceOptions がQtConcurrent::OrderedReduce の場合、reduceFunction は元のシーケンスの順序で呼び出されます。

「並行フィルタ」および「フィルタ・リデュース」も参照してください 。

template < typename ResultType, typename Sequence, typename KeepFunctor, typename ReduceFunctor, typename InitialValueType > QFuture<ResultType> QtConcurrent::filteredReduced(Sequence &&sequence, KeepFunctor &&filterFunction, ReduceFunctor &&reduceFunction, InitialValueType &&initialValue, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))

sequence 内の各項目について、filterFunction を1回ずつ呼び出します。ある項目に対してfilterFunction がtrue を返した場合、その項目はreduceFunction に渡されます。つまり、戻り値は、filterFunction がtrue を返す各項目について、reduceFunction の結果となります。結果値は関数の呼び出し時にinitialValue に初期化され、reduceFunction への最初の呼び出しはこの値に対して行われます。

なお、filterFunction は並行して呼び出されますが、reduceFunction を呼び出すのは一度に1つのスレッドのみです。reduceOptions がQtConcurrent::UnorderedReduce である場合、reduceFunction の呼び出し順序は未定義となります。reduceOptions がQtConcurrent::OrderedReduce である場合、reduceFunction は元のシーケンスの順序で呼び出されます。

「Concurrent Filter」および「Filter-Reduce」も参照してください 。

template < typename ResultType, typename Iterator, typename KeepFunctor, typename ReduceFunctor, typename InitialValueType > QFuture<ResultType> QtConcurrent::filteredReduced(Iterator begin, Iterator end, KeepFunctor &&filterFunction, ReduceFunctor &&reduceFunction, InitialValueType &&initialValue, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))

begin からend までの各項目について、filterFunction を 1 回ずつ呼び出します。ある項目に対してfilterFunction がtrue を返した場合、その項目はreduceFunction に渡されます。つまり、戻り値は、filterFunction がtrue を返す各項目について、reduceFunction の結果となります。結果値は関数の呼び出し時にinitialValue に初期化され、reduceFunction への最初の呼び出しはこの値に対して行われます。

なお、filterFunction は並行して呼び出されますが、reduceFunction を呼び出すのは一度に1つのスレッドのみです。reduceOptions がQtConcurrent::UnorderedReduce である場合、reduceFunction が呼び出される順序は未定義です。reduceOptions がQtConcurrent::OrderedReduce である場合、reduceFunction は元のシーケンスの順序で呼び出されます。

「並行フィルタ」および「フィルタ・リデュース」も参照してください 。

template < typename ResultType, typename Iterator, typename KeepFunctor, typename ReduceFunctor > QFuture<ResultType> QtConcurrent::filteredReduced(QThreadPool *pool, Iterator begin, Iterator end, KeepFunctor &&filterFunction, ReduceFunctor &&reduceFunction, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))

begin からend までの各項目について、filterFunction を 1 回ずつ呼び出します。filterFunction へのすべての呼び出しは、QThreadPool pool から取得したスレッドから実行されます。filterFunction が項目に対してtrue を返した場合、その項目はreduceFunction に渡されます。つまり、戻り値は、filterFunction がtrue を返す各項目について、reduceFunction の結果となります。

なお、filterFunction は並行して呼び出されますが、reduceFunction を呼び出すのは一度に1つのスレッドのみです。reduceOptions がQtConcurrent::UnorderedReduce である場合、reduceFunction が呼び出される順序は未定義となります。reduceOptions がQtConcurrent::OrderedReduce である場合、reduceFunction は元のシーケンスの順序で呼び出されます。

「並行フィルタ」および「フィルタ・リデュース」も参照してください 。

template < typename ResultType, typename Sequence, typename KeepFunctor, typename ReduceFunctor, typename InitialValueType > QFuture<ResultType> QtConcurrent::filteredReduced(QThreadPool *pool, Sequence &&sequence, KeepFunctor &&filterFunction, ReduceFunctor &&reduceFunction, InitialValueType &&initialValue, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))

sequence 内の各項目について、filterFunction を1回ずつ呼び出します。filterFunction へのすべての呼び出しは、QThreadPool のpool から取得されたスレッドから行われます。filterFunction が項目のtrue を返した場合、その項目はreduceFunction に渡されます。つまり、戻り値は、filterFunction がtrue を返す各項目について、reduceFunction の結果となります。結果値は関数が呼び出された際にinitialValue に初期化され、reduceFunction への最初の呼び出しはこの値に対して行われます。

なお、filterFunction は並行して呼び出されますが、reduceFunction を呼び出すのは一度に1つのスレッドのみです。reduceOptions がQtConcurrent::UnorderedReduce である場合、reduceFunction が呼び出される順序は未定義です。reduceOptions がQtConcurrent::OrderedReduce である場合、reduceFunction は元のシーケンスの順序で呼び出されます。

「Concurrent Filter」および「Filter-Reduce」も参照してください 。

template < typename ResultType, typename Iterator, typename KeepFunctor, typename ReduceFunctor, typename InitialValueType > QFuture<ResultType> QtConcurrent::filteredReduced(QThreadPool *pool, Iterator begin, Iterator end, KeepFunctor &&filterFunction, ReduceFunctor &&reduceFunction, InitialValueType &&initialValue, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))

begin からend までの各項目について、filterFunction を 1 回ずつ呼び出します。filterFunction へのすべての呼び出しは、QThreadPool pool から取得したスレッドから実行されます。filterFunction が特定の項目に対してtrue を返した場合、その項目はreduceFunction に渡されます。つまり、戻り値は、filterFunction がtrue を返す各項目について、reduceFunction の結果となります。 結果変数は、関数が呼び出された際にinitialValue に初期化され、reduceFunction への最初の呼び出しはこの値に対して実行されます。

filterFunction が並行して呼び出される一方で、reduceFunction は一度に1つのスレッドのみによって呼び出される点に注意してください。reduceOptions がQtConcurrent::UnorderedReduce である場合、reduceFunction が呼び出される順序は未定義です。reduceOptions がQtConcurrent::OrderedReduce である場合、reduceFunction は元のシーケンスの順序で呼び出されます。

「並行フィルタ」および「フィルタ・リデュース」も参照してください 。

template <typename Sequence, typename MapFunctor> QFuture<void> QtConcurrent::map(Sequence &&sequence, MapFunctor &&function)

sequence 内の各項目について、function を1回ずつ呼び出します。function は項目の参照を受け取るため、その項目に加えられた変更はすべてsequence に反映されます。

「並行 Map」および「Map-Reduce」も参照してください 。

template <typename Iterator, typename MapFunctor> QFuture<void> QtConcurrent::map(Iterator begin, Iterator end, MapFunctor &&function)

begin からend までの各項目について、function を 1 回ずつ呼び出します。function は項目の参照を受け取るため、その項目に加えられた変更は、イテレータが属するシーケンスに反映されます。

「並行マップ」および「マップ・リデュース」も参照してください 。

template <typename Sequence, typename MapFunctor> QFuture<void> QtConcurrent::map(QThreadPool *pool, Sequence &&sequence, MapFunctor &&function)

sequence 内の各項目について、function を1回ずつ呼び出します。function へのすべての呼び出しは、QThreadPool pool から取得したスレッドから実行されます。function は項目の参照を受け取るため、その項目に加えられた変更はすべてsequence に反映されます。

「並行マップ」および「マップ・リデュース」も参照してください 。

template <typename Iterator, typename MapFunctor> QFuture<void> QtConcurrent::map(QThreadPool *pool, Iterator begin, Iterator end, MapFunctor &&function)

begin からend までの各項目について、function を 1 回ずつ呼び出します。function へのすべての呼び出しは、QThreadPool pool から取得されたスレッドから実行されます。function は項目の参照を受け取るため、その項目に加えられた変更は、イテレータが属するシーケンスに反映されます。

「並行マップ」および「マップ・リデュース」も参照してください 。

template <typename Sequence, typename MapFunctor> QFuture<QtPrivate::MapResultType<Sequence, MapFunctor>> QtConcurrent::mapped(Sequence &&sequence, MapFunctor &&function)

sequence 内の各項目についてfunction を1回ずつ呼び出し、マッピングされた各項目を結果とするフューチャーを返します。QFuture::const_iterator またはQFutureIterator を使用して、結果を反復処理することができます。

「並行 Map」および「Map-Reduce」も参照してください 。

template <typename Iterator, typename MapFunctor> QFuture<QtPrivate::MapResultType<Iterator, MapFunctor>> QtConcurrent::mapped(Iterator begin, Iterator end, MapFunctor &&function)

begin からend までの各項目について、function を 1 回ずつ呼び出し、マッピングされた各項目を結果とするフューチャーを返します。結果を反復処理するには、QFuture::const_iterator またはQFutureIterator を使用できます。

「並行マップ」および「マップ・リデュース」も参照してください 。

template <typename Sequence, typename MapFunctor> QFuture<QtPrivate::MapResultType<Sequence, MapFunctor>> QtConcurrent::mapped(QThreadPool *pool, Sequence &&sequence, MapFunctor &&function)

sequence 内の各項目について、function を1回ずつ呼び出し、マッピングされた各項目を結果とするフューチャーを返します。function へのすべての呼び出しは、QThreadPool pool から取得されたスレッドから実行されます。結果を反復処理するには、QFuture::const_iterator またはQFutureIterator を使用できます。

「並行マップ」および「マップ・リデュース」も参照してください 。

template <typename Iterator, typename MapFunctor> QFuture<QtPrivate::MapResultType<Iterator, MapFunctor>> QtConcurrent::mapped(QThreadPool *pool, Iterator begin, Iterator end, MapFunctor &&function)

begin からend までの各項目について、function を 1 回ずつ呼び出し、マッピングされた各項目を結果とするフューチャーを返します。function へのすべての呼び出しは、QThreadPool pool から取得されたスレッドから実行されます。結果を反復処理するには、QFuture::const_iterator またはQFutureIterator を使用できます。

「並行マップ」および「マップ・リデュース」も参照してください 。

template < typename ResultType, typename Sequence, typename MapFunctor, typename ReduceFunctor > QFuture<ResultType> QtConcurrent::mappedReduced(Sequence &&sequence, MapFunctor &&mapFunction, ReduceFunctor &&reduceFunction, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))

sequence に含まれる各項目について、mapFunction を1回ずつ呼び出します。各mapFunction の戻り値は、reduceFunction に渡されます。

mapFunction は並行して呼び出されますが、reduceFunction を呼び出すのは一度に1つのスレッドのみであることに注意してください。reduceFunction の呼び出し順序は、reduceOptions によって決定されます。

「並行 Map」および「Map-Reduce」も参照してください 。

template < typename ResultType, typename Iterator, typename MapFunctor, typename ReduceFunctor > QFuture<ResultType> QtConcurrent::mappedReduced(Iterator begin, Iterator end, MapFunctor &&mapFunction, ReduceFunctor &&reduceFunction, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))

begin からend までの各項目について、mapFunction を 1 回ずつ呼び出します。各mapFunction の戻り値は、reduceFunction に渡されます。

mapFunction は並行して呼び出されますが、reduceFunction を呼び出すスレッドは一度に 1 つだけであることに注意してください。デフォルトでは、reduceFunction が呼び出される順序は未定義です。

注: QtConcurrent::OrderedReduce は 順序付きリダクションを生成します。

「並行 Map」および「Map-Reduce」も参照してください 。

template < typename ResultType, typename Sequence, typename MapFunctor, typename ReduceFunctor > QFuture<ResultType> QtConcurrent::mappedReduced(QThreadPool *pool, Sequence &&sequence, MapFunctor &&mapFunction, ReduceFunctor &&reduceFunction, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))

sequence 内の各項目について、mapFunction を1回ずつ呼び出します。mapFunction へのすべての呼び出しは、QThreadPool pool から取得されたスレッドから実行されます。各mapFunction の戻り値は、reduceFunction に渡されます。

なお、mapFunction は並行して呼び出されますが、reduceFunction を呼び出すスレッドは一度に1つだけです。reduceFunction が呼び出される順序は、reduceOptions によって決定されます。

「並行 Map」および「Map-Reduce」も参照してください 。

template < typename ResultType, typename Sequence, typename MapFunctor, typename ReduceFunctor, typename InitialValueType > QFuture<ResultType> QtConcurrent::mappedReduced(Sequence &&sequence, MapFunctor &&mapFunction, ReduceFunctor &&reduceFunction, InitialValueType &&initialValue, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))

sequence に含まれる各項目について、mapFunction を1回ずつ呼び出します。各mapFunction の戻り値は、reduceFunction に渡されます。結果値は関数の呼び出し時にinitialValue に初期化され、reduceFunction への最初の呼び出しはこの値に対して行われます。

なお、mapFunction は並行して呼び出されますが、reduceFunction を呼び出すのは一度に1つのスレッドのみです。reduceFunction が呼び出される順序は、reduceOptions によって決定されます。

「並行 Map」および「Map-Reduce」も参照してください 。

template < typename ResultType, typename Iterator, typename MapFunctor, typename ReduceFunctor, typename InitialValueType > QFuture<ResultType> QtConcurrent::mappedReduced(Iterator begin, Iterator end, MapFunctor &&mapFunction, ReduceFunctor &&reduceFunction, InitialValueType &&initialValue, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))

begin からend までの各項目について、mapFunction を 1 回ずつ呼び出します。各mapFunction の戻り値は、reduceFunction に渡されます。結果値は関数の呼び出し時にinitialValue に初期化され、reduceFunction への最初の呼び出しはこの値に対して行われます。

なお、mapFunction は並行して呼び出されますが、reduceFunction を呼び出すのは一度に1つのスレッドのみです。デフォルトでは、reduceFunction が呼び出される順序は未定義です。

注: QtConcurrent::OrderedReduce は 順序付きリダクションを生成します。

「並行 Map」および「Map-Reduce」も参照してください 。

template < typename ResultType, typename Iterator, typename MapFunctor, typename ReduceFunctor > QFuture<ResultType> QtConcurrent::mappedReduced(QThreadPool *pool, Iterator begin, Iterator end, MapFunctor &&mapFunction, ReduceFunctor &&reduceFunction, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))

begin からend までの各項目について、mapFunction を 1 回ずつ呼び出します。mapFunction へのすべての呼び出しは、QThreadPool pool から取得したスレッドから実行されます。各mapFunction の戻り値は、reduceFunction に渡されます。

mapFunction は並行して呼び出されますが、reduceFunction を呼び出すのは一度に1つのスレッドのみであることに注意してください。デフォルトでは、reduceFunction が呼び出される順序は未定義です。

注: QtConcurrent::OrderedReduce は 順序付きリダクションを生成します。

「並行 Map」および「Map-Reduce」も参照してください 。

template < typename ResultType, typename Sequence, typename MapFunctor, typename ReduceFunctor, typename InitialValueType > QFuture<ResultType> QtConcurrent::mappedReduced(QThreadPool *pool, Sequence &&sequence, MapFunctor &&mapFunction, ReduceFunctor &&reduceFunction, InitialValueType &&initialValue, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))

sequence に含まれる各項目について、mapFunction を1回ずつ呼び出します。mapFunction へのすべての呼び出しは、QThreadPool pool から取得されたスレッドから実行されます。各mapFunction の戻り値は、reduceFunction に渡されます。result値は関数の呼び出し時にinitialValue に初期化され、reduceFunction への最初の呼び出しはこの値に対して行われます。

なお、mapFunction は並行して呼び出されますが、reduceFunction を呼び出すのは一度に1つのスレッドのみです。reduceFunction が呼び出される順序は、reduceOptions によって決定されます。

「並行 Map」および「Map-Reduce」も参照してください 。

template < typename ResultType, typename Iterator, typename MapFunctor, typename ReduceFunctor, typename InitialValueType > QFuture<ResultType> QtConcurrent::mappedReduced(QThreadPool *pool, Iterator begin, Iterator end, MapFunctor &&mapFunction, ReduceFunctor &&reduceFunction, InitialValueType &&initialValue, QtConcurrent::ReduceOptions reduceOptions = ReduceOptions(UnorderedReduce | SequentialReduce))

begin からend までの各項目について、mapFunction を 1 回ずつ呼び出します。mapFunction へのすべての呼び出しは、QThreadPool pool から取得されたスレッドから行われます。各mapFunction の戻り値は、reduceFunction に渡されます。result 変数は、関数が呼び出された際にinitialValue に初期化され、reduceFunction への最初の呼び出しはこの値に対して実行されます。

なお、mapFunction は並行して呼び出されますが、reduceFunction を呼び出すのは一度に1つのスレッドのみです。デフォルトでは、reduceFunction が呼び出される順序は未定義です。

注: QtConcurrent::OrderedReduce は 順序付きリダクションを生成します。

「並行Map」および「Map-Reduce」も参照してください 。

template <typename T> QFuture<T> QtConcurrent::run(Function function, ...)

以下と同等です

QtConcurrent::run(QThreadPool::globalInstance(), function, ...);

function を別のスレッドで実行します。スレッドはグローバル変数QThreadPool から取得されます。function は直ちに実行されない場合があることに注意してください。function は、スレッドが利用可能になって初めて実行されます。

基本モードでは、T はfunction の戻り値と同じ型になります。void 以外の戻り値には、QFuture::result() 関数を介してアクセスできます。

基本モードでは、返されるQFuture は、実行中/完了ステータスおよび関数の戻り値の照会のみに使用できます。特に、キャンセルや一時停止は、そのフューチャーに関連する計算がまだ開始されていない場合にのみ発行できます。

「run with promise」モードでは、function はvoidを返すものとされ、関数の引数リストの最初の引数として、QPromise<T> & 型の追加引数を受け取る必要があります。Tは結果型であり、返されるQFuture<T> についても同様です。

「run with promise」モードでは、基本モードと同様に、返されたQFuture を使用して、実行中/完了ステータスや関数が報告した値を照会できます。さらに、実行中のタスクを一時停止またはキャンセルしたり、呼び出されたfunction から複数の結果を取得したり、function が報告する進行状況を監視したりするためにも使用できます。

「並行実行(基本モード)」、「Promise を使用した並行実行」、および「QThreadPool::start()」も参照してください 。

template <typename T> QFuture<T> QtConcurrent::run(QThreadPool *pool, Function function, ...)

pool 上でfunction をスケジュールします。function は直ちに実行されない場合があることに注意してください。function は、スレッドが利用可能になって初めて実行されます。

基本モードでは、T はfunction の戻り値と同じ型になります。void 以外の戻り値には、QFuture::result() 関数を介してアクセスできます。

基本モードでは、返されるQFuture は、実行中/完了ステータスおよび関数の戻り値の照会のみに使用できます。特に、キャンセルや一時停止は、そのfutureに関連する計算がまだ開始されていない場合にのみ発行できます。

「run with promise」モードでは、function はvoidを返すものとされ、関数の引数リストの最初の引数として、QPromise<T> & 型の追加引数を受け取る必要があります。Tは結果型であり、返されるQFuture<T> についても同様です。

「run with promise」モードでは、基本モードと同様に、返されるQFuture を使用して、実行中/完了ステータスや関数が報告した値の照会を行うことができます。さらに、これを使用して、実行中のタスクを一時停止またはキャンセルしたり、呼び出されたfunction から複数の結果を取得したり、function が報告する進行状況を監視したりすることも可能です。

「 並列実行(基本モード)」、「Promise を使用した並列実行」、および「QThreadPool::start()」も参照してください 。

[since 6.0] template <typename Task> QtConcurrent::QTaskBuilder<Task> QtConcurrent::task(Task &&task)

QtConcurrent::QTaskBuilder のインスタンスを作成します。このオブジェクトを使用すると、いくつかのパラメータを調整したり、task を別のスレッドで実行したりすることができます。

この関数は Qt 6.0 で導入されました。

「Concurrent Task」および「QtConcurrent::QTaskBuilder 」も参照してください 。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.