std::indirectly_movable_storable

std::indirectly_movable_storable (간접 이동·저장 가능 컨셉)

indirectly_readable 타입과 indirectly_writable 타입 사이의 관계를 명세하는 컨셉이에요. indirectly_movable 외에도, 중간 객체를 통해 이동할 수 있음을 명세해요. C++20부터 있어요.

출처: cppreference

본문

<iterator> 헤더에 정의돼 있어요.

template< class In, class Out >
concept indirectly_movable_storable =
    std::indirectly_movable<In, Out> &&
    std::indirectly_writable<Out, std::iter_value_t<In>> &&
    std::movable<std::iter_value_t<In>> &&
    std::constructible_from<std::iter_value_t<In>, std::iter_rvalue_reference_t<In>> &&
    std::assignable_from<std::iter_value_t<In>&, std::iter_rvalue_reference_t<In>>;

indirectly_movable_storable 컨셉은 indirectly_readable 타입과 indirectly_writable 타입 사이의 관계를 명세해요. indirectly_movable에 추가로, indirectly_readable 타입에서의 이동이 중간 객체를 통해 수행될 수 있음을 명세해요.

의미 요구사항

역참조 가능한 객체가 있을 때, InOut은 그 값 타입이 movable이고 값 타입이 rvalue 참조로부터 생성·대입 가능할 때만 std::indirectly_movable_storable<In, Out>을 모델링해요.

예제

#include <iterator>
#include <vector>
#include <concepts>

int main()
{
    static_assert(std::indirectly_movable_storable<std::vector<int>::iterator,
                                                   std::vector<int>::iterator>);
}

더 알아보기 (Learn more)

cppreference