The Wayback Machine - https://web.archive.org/web/20180305141917/http://ja.cppreference.com:80/w/cpp/algorithm
名前空間
変種
操作

アルゴリズムライブラリ

提供: cppreference.com
< cpp
 
 
アルゴリズムライブラリ
実行ポリシー (C++17)
非変更シーケンス操作
all_of
any_of
none_of
(C++11)
(C++11)
(C++11)
for_each
for_each_n(C++17)
変更シーケンス操作
未初期化記憶域の操作
分割操作
ソート操作
バイナリサーチ操作
集合操作 (ソート済み範囲に対する)
ヒープ操作
is_heap(C++11)
is_heap_until(C++11)
最小/最大演算
minmax(C++11)
minmax_element(C++11)
clamp(C++17)
compare_3way(C++20)
順列
数値演算
C のライブラリ
 

アルゴリズムライブラリは要素の範囲に対して操作を行う様々な目的 (検索、ソート、計数、操作など) の関数を定義します。 範囲は [first, last) として定義され、 last は調査または変更する最後の要素のの要素を参照することに注意してください。

目次

実行ポリシー

ほとんどのアルゴリズムには実行ポリシーを受け取るオーバーロードがあります。 標準ライブラリのアルゴリズムは3つの実行ポリシー sequential, parallel, parallel+vector をサポートしており、対応する実行ポリシーの型とオブジェクトが提供されます。 ユーザは対応する型の実行ポリシーオブジェクト std::execution::seq, std::execution::par, std::execution::par_unseq のいずれかを指定して並列アルゴリズムを呼び出すことで、実行ポリシーを静的に選択できます。

標準ライブラリの実装は拡張として追加の実行ポリシーを定義している場合があります。 処理系定義型の実行ポリシーオブジェクトを指定して並列アルゴリズムを呼び出した場合のセマンティクスは処理系定義です。

ヘッダ <execution> で定義
名前空間 std::execution で定義
実行ポリシーの型
(クラス)[edit]
(C++17)
(C++17)
(C++17)
グローバルな実行ポリシーオブジェクト
(定数)[edit]
名前空間 std で定義
クラスが実行ポリシーを表すかどうか調べます
(クラステンプレート)[edit]
(C++17およびそれ以降)
非変更シーケンス操作
ヘッダ <algorithm> で定義
(C++11)
(C++11)
(C++11)
述語かどうかをチェックするには、すべてのtrue、範囲内の要素のいずれか、またはnoneです
Original:
checks if a predicate is true for all, any or none of the elements in a range
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
ある範囲の要素に関数が適用されます
Original:
applies a function to a range of elements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
applies a function object to the first n elements of a sequence
(関数テンプレート)[edit]
特定の条件を満たす要素の数を返します
Original:
returns the number of elements satisfying specific criteria
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
2の範囲が異なる最初の位置を見つけます
Original:
finds the first position where two ranges differ
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
特定の条件を満たす最初の要素を検索します
Original:
finds the first element satisfying specific criteria
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
一定の範囲内にある要素の最後のシーケンスを見つけることができます
Original:
finds the last sequence of elements in a certain range
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
searches for any one of a set of elements
(関数テンプレート)[edit]
互いに隣接する2つの同一の(またはいくつかの他の関係)のアイテムを見つけることができます
Original:
finds two identical (or some other relationship) items adjacent to each other
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
ある範囲の要素を検索します
(関数テンプレート)[edit]
範囲内の要素の数は連続したコピーを検索します
Original:
searches for a number consecutive copies of an element in a range
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
変更シーケンス操作
ヘッダ <algorithm> で定義
新しい場所に要素の範囲をコピーします
Original:
copies a range of elements to a new location
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
(C++11)
新しい場所にある要素の数をコピーします
Original:
copies a number of elements to a new location
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
コピー下位の順序で要素の範囲
Original:
copies a range of elements in backwards order
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
(C++11)
新しい場所に要素の範囲を移動します
Original:
moves a range of elements to a new location
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
下位の順序で新しい場所に要素の範囲を移動します
Original:
moves a range of elements to a new location in backwards order
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
要素の範囲を特定の値を割り当てます
Original:
assigns a range of elements a certain value
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
要素の数に値を代入します
Original:
assigns a value to a number of elements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
ある範囲の要素に関数が適用されます
Original:
applies a function to a range of elements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
範囲内の関数の結果を保存します
Original:
saves the result of a function in a range
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
関数のNアプリケーションの結果を保存します
Original:
saves the result of N applications of a function
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
特定の条件を満たす要素を削除します
Original:
removes elements satisfying specific criteria
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
特定の条件を満たすものを省略要素の範囲をコピーします
Original:
copies a range of elements omitting those that satisfy specific criteria
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
別の値を使用して、特定の条件を満たすすべての値を置き換えます
Original:
replaces all values satisfying specific criteria with another value
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
別の値を使用して、特定の条件を満たす要素を置き換えて、範囲をコピーします
Original:
copies a range, replacing elements satisfying specific criteria with another value
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
2つのオブジェクトの値を交換します
(関数テンプレート)[edit]
スワップの要素の2つの範囲を
Original:
swaps two ranges of elements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
スワップ二つのイテレータが指す要素
Original:
swaps the elements pointed to by two iterators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
範囲内の秩序の要素を反転します
Original:
reverses the order elements in a range
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
逆転された範囲のコピーを作成します
Original:
creates a copy of a range that is reversed
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
範囲内の要素の順序を回転させます
Original:
rotates the order of elements in a range
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
コピーと要素の範囲を回転させます
Original:
copies and rotate a range of elements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
(C++17以前)
(C++11)
範囲内の要素をランダムに並べ替えます
(関数テンプレート)[edit]
(C++17)
selects n random elements from a sequence
(関数テンプレート)[edit]
ある範囲内で連続して重複している要素を取り除きます
(関数テンプレート)[edit]
全く連続した重複を含まない要素のいくつか範囲のコピーを作成します
Original:
creates a copy of some range of elements that contains no consecutive duplicates
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
分割操作
ヘッダ <algorithm> で定義
範囲が指定された述語によって仕切られているかどうかを判断します
Original:
determines if the range is partitioned by the given predicate
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
二つのグループに要素の範囲を分割します
Original:
divides a range of elements into two groups
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
copies a range dividing the elements into two groups
(関数テンプレート)[edit]
それらの相対的な順序を維持しながら、二つのグループに要素を分割します
Original:
divides elements into two groups while preserving their relative order
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
locates the partition point of a partitioned range
(関数テンプレート)[edit]
ソート操作
ヘッダ <algorithm> で定義
(C++11)
範囲は昇順にソートされているかどうかをチェックします
Original:
checks whether a range is sorted into ascending order
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
最大のソート部分範囲を見つけることができます
Original:
finds the largest sorted subrange
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
昇順にソートする範囲
Original:
sorts a range into ascending order
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
ソート範囲の最初のN要素
Original:
sorts the first N elements of a range
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
コピーと部分的にソートする要素の範囲
Original:
copies and partially sorts a range of elements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
ソートされた範囲の要素を等しい要素間の順序を維持しながら
Original:
sorts a range of elements while preserving order between equal elements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
部分的にソートされ、指定された範囲は、それが与えられた要素によって仕切られていることを確認すること
Original:
partially sorts the given range making sure that it is partitioned by the given element
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
バイナリサーチ操作 (ソート済み範囲に対する)
ヘッダ <algorithm> で定義
最初の要素を指すイテレータを返す指定した値より小さくない
Original:
returns an iterator to the first element not less than the given value
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
最初の要素を指すイテレータを返す特定の値より大きい
Original:
returns an iterator to the first element greater than a certain value
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
要素が一定の範囲内に存在するかどうかを決定します
Original:
determines if an element exists in a certain range
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
特定のキーと一致する要素の範囲を返します
Original:
returns range of elements matching a specific key
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
集合操作 (ソート済み範囲に対する)
ヘッダ <algorithm> で定義
2つのソートされた範囲をマージします
Original:
merges two sorted ranges
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
その場で2つの順序の範囲をマージします
Original:
merges two ordered ranges in-place
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
1セットが他のサブセットである場合はtrueを返します
Original:
returns true if one set is a subset of another
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
2つの集合の差分を計算します
(関数テンプレート)[edit]
2つの集合の積を計算します
(関数テンプレート)[edit]
2セット間の対称差を計算します
Original:
computes the symmetric difference between two sets
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
2つの集合の和を計算します。
(関数テンプレート)[edit]
ヒープ操作
ヘッダ <algorithm> で定義
(C++11)
checks if the given range is a max heap
(関数テンプレート)[edit]
ヒープで最大の部分範囲を見つけることができます
Original:
finds the largest subrange that is heap
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
要素の範囲外のヒープを作成します
Original:
creates a heap out of a range of elements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
ヒープに要素を追加します
Original:
adds an element to a heap
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
ヒープから最大要素を削除します
Original:
removes the largest element from a heap
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
要素の並べ替えられた範囲にヒープを回す
Original:
turns a heap into a sorted range of elements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
最小/最大演算
ヘッダ <algorithm> で定義
二つの要素のうちの大きい方を返します
Original:
returns the larger of two elements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
範囲内の最大の要素を返します
Original:
returns the largest element in a range
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
二つの要素のうち、小さい方を返します
Original:
returns the smaller of two elements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
範囲内の最小の要素を返します
Original:
returns the smallest element in a range
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
(C++11)
大きく2つの要素のうち小さい方を返します
Original:
returns the larger and the smaller of two elements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
範囲内の最小と最大の要素を返します
Original:
returns the smallest and the largest element in a range
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
(C++17)
clamps a value between a pair of boundary values
(関数テンプレート)[edit]
比較演算
ヘッダ <algorithm> で定義
要素の2セットが同じかどうかを判断します
Original:
determines if two sets of elements are the same
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
1範囲が別のより辞書式に小さい場合はtrueを返します
Original:
returns true if one range is lexicographically less than another
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
compares two values using three-way comparison
(関数テンプレート)[edit]
compares two ranges using three-way comparison
(関数テンプレート)[edit]
順列操作
ヘッダ <algorithm> で定義
あるシーケンスが別のシーケンスの順列並び替えになっているか検査します
(関数テンプレート)[edit]
generates the next greater lexicographic permutation of a range of elements
(関数テンプレート)[edit]
generates the next smaller lexicographic permutation of a range of elements
(関数テンプレート)[edit]
数値演算
ヘッダ <numeric> で定義
(C++11)
開始値の連続刻みで範囲を塗りつぶします
Original:
fills a range with successive increments of the starting value
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
要素の範囲をまとめている
Original:
sums up a range of elements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
要素の2つの範囲の内積を計算します
Original:
computes the inner product of two ranges of elements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
範囲内の隣接する要素間の差を計算します
Original:
computes the differences between adjacent elements in a range
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
要素の範囲の部分和を計算します
Original:
computes the partial sum of a range of elements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
(C++17)
similar to std::accumulate, except out of order
(関数テンプレート)[edit]
similar to std::partial_sum, excludes the ith input element from the ith sum
(関数テンプレート)[edit]
similar to std::partial_sum, includes the ith input element in the ith sum
(関数テンプレート)[edit]
applies a functor, then reduces out of order
(関数テンプレート)[edit]
applies a functor, then calculates exclusive scan
(関数テンプレート)[edit]
applies a functor, then calculates inclusive scan
(関数テンプレート)[edit]
未初期化記憶域の操作
ヘッダ <memory> で定義
メモリの初期化されていない領域へのオブジェクトの範囲をコピーします
Original:
copies a range of objects to an uninitialized area of memory
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
メモリの初期化されていない領域へのオブジェクトの数をコピーします
Original:
copies a number of objects to an uninitialized area of memory
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
メモリの初期化されていない領域にオブジェクトをコピーします
Original:
copies an object to an uninitialized area of memory
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
メモリの初期化されていない領域にオブジェクトをコピーします
Original:
copies an object to an uninitialized area of memory
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)[edit]
moves a range of objects to an uninitialized area of memory
(関数テンプレート)[edit]
moves a number of objects to an uninitialized area of memory
(関数テンプレート)[edit]
constructs objects by default-initialization in an uninitialized area of memory, defined by a range
(関数テンプレート)[edit]
constructs objects by default-initialization in an uninitialized area of memory, defined by a start and a count
(関数テンプレート)[edit]
constructs objects by value-initialization in an uninitialized area of memory, defined by a range
(関数テンプレート)[edit]
constructs objects by value-initialization in an uninitialized area of memory, defined by a start and a count
(関数テンプレート)[edit]
指定されたアドレスにあるオブジェクトを破壊します
(関数テンプレート)[edit]
(C++17)
オブジェクトの範囲を破壊します
(関数テンプレート)[edit]
(C++17)
範囲内のいくつかのオブジェクトを破壊します
(関数テンプレート)[edit]
C のライブラリ
ヘッダ <cstdlib> で定義
ソートされていない型を持つ要素の範囲
Original:
sorts a range of elements with unspecified type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数)[edit]
不特定の型の要素の配列を検索します
Original:
searches an array for an element of unspecified type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数)[edit]


[編集]関連項目

アルゴリズムC言語リファレンス
close