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

FreeBSD Manual Pages

  
 
  

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

NAME
       std::ranges::drop_while_view::drop_while_view			     -
       std::ranges::drop_while_view::drop_while_view

Synopsis
	  drop_while_view() requires std::default_initializable<V> &&
				     std::default_initializable<Pred>	     =
       (1) (since C++20)
	  default;
	  constexpr   explicit	 drop_while_view(   V	base,	Pred  pred  );
       (2) (since C++20)

	  Constructs a drop_while_view.

	  1) Default constructor. Value-initializes the	 underlying  view  and
       the predicate.
	  2)  Move  constructs the underlying view from	base and the predicate
       from pred.

Parameters
	  base - underlying view
	  pred - predicate

Example
       // Run this code

	#include <array>
	#include <iostream>
	#include <ranges>

	int main()
	{
	    constexpr std::array data{0, -1, -2, 3, 1, 4, 1, 5};

	    auto view =	std::ranges::drop_while_view
	    {
		data, [](int x)	{ return x <= 0; }
	    };

	    for	(int x : view)
		std::cout << x << ' ';
	    std::cout << '\n';
	}

Output:
	3 1 4 1	5

	  Defect reports

	  The following	behavior-changing defect reports were applied retroac-
       tively to
	  previously published C++ standards.

	     DR	    Applied to	      Behavior as  published		  Cor-
       rect behavior
	  LWG  3714   C++20	  the multi-parameter constructor was made ex-
       plicit
	  (P2711R1)	       not explicit
			       if Pred is not
			       default_initializable,	the    default	   the
       drop_while_view is also
	  P2325R3    C++20	 constructor			      not  de-
       fault_initializable
			       constructs a drop_while_view which
			       does not	contain	an Pred

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

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

home | help