Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
std::ranges...ansform_view(3) C++ Standard Libarystd::ranges...ansform_view(3)

NAME
       std::ranges::adjacent_transform_view::adjacent_transform_view	     -
       std::ranges::adjacent_transform_view::adjacent_transform_view

Synopsis
	  adjacent_transform_view()  =	default;			   (1)
       (since C++23)
	  constexpr  explicit  adjacent_transform_view(	 V  base, F fun	); (2)
       (since C++23)

	  Constructs an	adjacent_transform_view.

	  1) Default constructor. Default-initializes the underlying data mem-
       bers fun_ and
	  inner_.
	  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
       // Run this code

	#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

http://cppreference.com		  2024.06.10	 std::ranges...ansform_view(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=std::ranges::adjacent_transform_view::adjacent_transform_view&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help