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부터)

이 개념은 전위 및 후위 증가 연산자로 증가시킬 수 있는 타입에 대한 요구사항을 명시하며, 증가 연산이 equality-preserving 이고 해당 타입이 std::equality_comparable 인 경우를 규정합니다.

std::weakly_incrementable 과 달리, 단일 패스 알고리즘만 지원하는 반면, std::incrementable 을 모델링하는 타입에는 다중 패스 단방향 알고리즘을 사용할 수 있습니다.

의미론적 요구사항

I 는 다음 조건을 만족할 때에만 std::incrementable 를 모델합니다: I 타입의 두 증가 가능 객체 a b 가 주어졌을 때:

  • bool ( a == b ) bool ( a ++ == b ) 를 함의하며,
  • bool ( a == b ) bool ( ( ( void ) a ++ , a ) == ++ b ) 를 함의합니다.

동등성 보존

표준 라이브러리 개념의 requires expressions 에 선언된 표현식들은 equality-preserving 해야 합니다(다르게 명시된 경우를 제외하고).

참고 항목

semiregular 타입이 전위 및 후위 증가 연산자로 증가될 수 있음을 명시함
(concept)
(C++20)
한 타입이 다른 타입과 동일함을 명시함
(concept)