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

FreeBSD Manual Pages

  
 
  

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

NAME
       std::ranges::drop_while_view::begin - std::ranges::drop_while_view::be-
       gin

Synopsis
	  constexpr auto begin();  (since C++20)

	  Returns an iterator to the first element of the view.

	  Effectively  returns	ranges::find_if_not(base_, std::cref(pred())),
       where base_ is
	  the underlying view. The behavior is undefined  if  *this  does  not
       store a predicate.

	  In  order to provide the amortized constant time complexity required
       by the range
	  concept, this	function caches	the result within the  drop_while_view
       object for use
	  on subsequent	calls.

Parameters
	  (none)

Return value
	  Iterator to the first	element	of the view.

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; }
	    };

	    std::cout << *view.begin() << '\n';
	}

Output:
	3

See also
	  end	  returns an iterator or a sentinel to the end
	  (C++20) (public member function)

http://cppreference.com		  2022.07.31	 std::ranges..._view::begin(3)

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

home | help