Namespaces
Variants

std::execution:: then

From cppreference.net
헤더에 정의됨 <execution>
execution :: sender auto then ( execution :: sender auto input,
std:: invocable < /*values-sent-by*/ ( input ) ... > function ) ;
(C++26부터)

매개변수

input - 실행 시 함수가 실행되는 값들을 전송하는 발신자
function - 입력 발신자에 연결된 새로운 발신자가 호출할 호출 가능 객체

반환값

입력 발신자가 전송한 값을 인수로 하여 제공된 함수를 호출하는 노드를 추가한, 입력 발신자가 설명하는 태스크 그래프를 설명하는 발신자를 반환합니다.

then 은 반환된 sender가 시작될 때까지 함수 실행이 시작되지 않도록 보장합니다.

예제

execution::then 의 가능한 사용법.

execution::sender auto input = get_input();
execution::sender auto snd = execution::then(input, [](auto... args)
{
    std::print(args...);
});
// snd는 pred에 의해 기술된 작업을 설명합니다
// 뒤이어 pred가 전송한 모든 값들을 출력합니다