std::indirect_strict_weak_order
std::indirect_strict_weak_order (간접 엄밀 약순서 컨셉)
인자로 엄밀 약순서를 호출하는 알고리즘에 대한 요구사항을 명세하는 컨셉이에요. std::strict_weak_order와 달리 I1·I2 자체가 아니라 그것들이 참조하는 타입에 적용돼요. C++20부터 있어요.
출처: cppreference
본문
<iterator> 헤더에 정의돼 있어요.
template< class F, class I1, class I2 = I1 >
concept indirect_strict_weak_order =
std::indirectly_readable<I1> &&
std::indirectly_readable<I2> &&
std::copy_constructible<F> &&
std::strict_weak_order
<F&, /*indirect-value-t*/<I1>, /*indirect-value-t*/<I2>> &&
std::strict_weak_order
<F&, /*indirect-value-t*/<I1>, std::iter_reference_t<I2>> &&
std::strict_weak_order
<F&, std::iter_reference_t<I1>, /*indirect-value-t*/<I2>> &&
std::strict_weak_order
<F&, std::iter_reference_t<I1>, std::iter_reference_t<I2>>;
indirect_strict_weak_order 컨셉은 인자로 엄밀 약순서를 호출하는 알고리즘에 대한 요구사항을 명세해요. 이 컨셉과 std::strict_weak_order의 핵심 차이는 I1·I2 자체가 아니라 그것들이 참조하는 타입에 적용된다는 점이에요. 값·참조 타입의 네 가지 조합 모두에서 성립해야 해요.
예제
#include <iterator>
#include <vector>
#include <concepts>
#include <functional>
int main()
{
static_assert(std::indirect_strict_weak_order<std::less<>>,
std::vector<int>::iterator, std::vector<int>::iterator>);
}