std::permutable
std::permutable (순열 변환 가능 컨셉)
이동·교환을 통해 요소를 재배열하기 위한 요구사항을 추가해 std::forward_iterator를 정제하는 컨셉이에요. C++20부터 있어요.
출처: cppreference
본문
<iterator> 헤더에 정의돼 있어요.
template< class I >
concept permutable =
std::forward_iterator<I> &&
std::indirectly_movable_storable<I, I> &&
std::indirectly_swappable<I, I>;
permutable 컨셉은 이동·교환을 통해 재배열하기 위한 요구사항을 추가해 std::forward_iterator를 정제해요. reverse, rotate, shuffle 등의 재배열 알고리즘에 필요한 요구사항이에요.
의미 요구사항
I는 그것이 포함하는 모든 컨셉이 모델링될 때만 permutable을 모델링해요.
예제
#include <iterator>
#include <vector>
#include <concepts>
int main()
{
static_assert(std::permutable<std::vector<int>::iterator>);
}