Namespaces
Variants

std::ranges::adjacent_transform_view<V,F,N>::adjacent_transform_view

cppreference.net에서
 
 
범위 라이브러리
범위 어댑터
 
 
adjacent_transform_view() = default;
(1) (since C++23)
constexpr explicit adjacent_transform_view( V base, F fun );
(2) (since C++23)

adjacent_transform_view를 생성합니다 adjacent_transform_view.

1) 기본 생성자. 기본 초기화합니다 기본 데이터 멤버 fun_와 inner_.
2) 기본 데이터 멤버를 이동 생성합니다: fun_으로 std::move(fun)와 inner_으로 std::move(base).

매개변수

base - 기본 뷰
fun - N-ary 변환 함수

예제

#include <algorithm>
#include <iostream>
#include <iterator>
#include <ranges>
int main()
{
    constexpr static auto v = {1, 2, 3, 4, 5};
    constexpr auto mul = [](auto... x) { return (... * x); };
    constexpr auto view = std::views::adjacent_transform<3>(v, mul);
    std::ranges::copy(view, std::ostream_iterator<int>(std::cout, " "));
    std::cout << '\n';
}

출력:

6 24 60