std::partition_point
提供: cppreference.com
![]() | このページは、Google 翻訳を使って英語版から機械翻訳されました。 翻訳には誤りや奇妙な言い回しがあるかもしれません。文章の上にポインタをおくと、元の文章が見れます。誤りを修正して翻訳を改善する手助けをしてください。翻訳についての説明は、ここをクリックしてください。 |
Defined in header <algorithm> | ||
template<class ForwardIt, class UnaryPredicate > ForwardIt partition_point( ForwardIt first, ForwardIt last, UnaryPredicate p); | (1) | (C++11およびそれ以降) |
調べパーティションstd::partitionと位置範囲(として
[first, last)
であれば)最初のパーティションの終わり、それは、満足していない最初の要素であるp
またはlast
最後の場合、すべての要素がp
を満たしている場合.Original:
Examines the partitioned (as if by std::partition) range
[first, last)
and locates the end of the first partition, that is, the first element that does not satisfy p
or last
if last if all elements satisfy p
.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
目次 |
[編集]パラメータ
first, last | - | 検討する要素のレンジ·パーティション化 Original: the partitioned range of elements to examine The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
p | - | unary predicate which returns true 範囲の先頭で見つかった要素のため . Original: for the elements found in the beginning of the range The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. The signature of the predicate function should be equivalent to the following: bool pred(const Type &a); The signature does not need to have const&, but the function must not modify the objects passed to it. |
型の要件 | ||
-ForwardIt は ForwardIterator の要求を満足しなければなりません。 |
[編集]値を返します
[first, last)
内またはlast
すべての要素がp
を満たしている場合、最初のパーティションの終わり過去イテレータ.Original:
The iterator past the end of the first partition within
[first, last)
or last
if all elements satisfy p
.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[編集]複雑性
first
last
との間の距離の対数Original:
Logarithmic in the distance between
first
and last
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[編集]例
このコードを実行します
#include <algorithm>#include <array>#include <iostream>#include <iterator> int main(){std::array<int, 9> v ={1, 2, 3, 4, 5, 6, 7, 8, 9}; auto is_even =[](int i){return i %2==0;};std::partition(v.begin(), v.end(), is_even); auto p = std::partition_point(v.begin(), v.end(), is_even); std::cout<<"Before partition:\n ";std::copy(v.begin(), p, std::ostream_iterator<int>(std::cout, " "));std::cout<<"\nAfter partition:\n ";std::copy(p, v.end(), std::ostream_iterator<int>(std::cout, " "));}
出力:
Before partition: 8 2 6 4 After partition: 5 3 7 1 9
[編集]参照
(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. (関数テンプレート) |