On this page
std::ranges::adjacent_transform_view<V,F,N>::adjacent_transform_view
|
(1) | (since C++23) |
|
(2) | (since C++23) |
Constructs an adjacent_transform_view
.
2) Move constructs the underlying data members:
fun_
with std::move(fun)
and inner_
with std::move(base)
.
Parameters
base | - | the underlying view |
fun | - | the N-ary transformation function |
Example
#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';
}
Output:
6 24 60
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/ranges/adjacent_transform_view/adjacent_transform_view