Namespaces
Variants

std:: incrementable

From cppreference.net
Iterator library
Iterator concepts
Iterator primitives
Algorithm concepts and utilities
Indirect callable concepts
Common algorithm requirements
(C++20)
(C++20)
(C++20)
Utilities
(C++20)
Iterator adaptors
Range access
(C++11) (C++14)
(C++14) (C++14)
(C++11) (C++14)
(C++14) (C++14)
(C++17) (C++20)
(C++17)
(C++17)
ヘッダー <iterator> で定義
template < class I >

concept incrementable =
std:: regular < I > &&
std:: weakly_incrementable < I > &&
requires ( I i ) {
{ i ++ } - > std:: same_as < I > ;

} ;
(C++20以降)

このコンセプトは、前置および後置インクリメント演算子でインクリメント可能な型に対する要件を定義します。これらのインクリメント操作は 等価性保存 であり、かつその型は std::equality_comparable です。

std::weakly_incrementable が単一パスアルゴリズムのみをサポートするのとは異なり、多方向単一パスアルゴリズムは std::incrementable をモデル化する型で使用できます。

セマンティック要件

I は、型 I の2つのインクリメント可能なオブジェクト a b が与えられた場合にのみ std::incrementable をモデル化します:

  • bool ( a == b ) bool ( a ++ == b ) を意味し、
  • bool ( a == b ) bool ( ( ( void ) a ++ , a ) == ++ b ) を意味する。

等価性保存

標準ライブラリコンセプトの requires expressions で宣言される式は、 equality-preserving であることが要求されます(特に明記されている場合を除く)。

関連項目

semiregular 型が前置および後置インクリメント演算子でインクリメント可能であることを指定する
(コンセプト)
(C++20)
型が別の型と同じであることを指定する
(コンセプト)