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

FreeBSD Manual Pages

  
 
  

home | help
std::ranges...t_view::end(3)  C++ Standard Libary std::ranges...t_view::end(3)

NAME
       std::ranges::split_view::end - std::ranges::split_view::end

Synopsis
	  constexpr auto end() const;  (since C++20)

	  Returns  an  iterator	 or a sentinel representing the	end of the re-
       sulting subrange.

	  Equivalent to:

	constexpr auto end()
	{
	    if constexpr (ranges::common_range<V>)
		return /*iterator*/{*this, ranges::end(base_), {}};
	    else
		return /*sentinel*/{*this};
	}

Parameters
	  (none)

Return value
	  An iterator or a sentinel.

Example
       // Run this code

	#include <iostream>
	#include <ranges>
	#include <string_view>

	int main()
	{
	    constexpr std::string_view keywords{"bitand	bitor bool break"};
	    std::ranges::split_view kw{keywords, ' '};
	    const auto count = std::ranges::distance(kw.begin(), kw.end());
	    std::cout << "Words	count: " << count << '\n';
	}

Output:
	Words count: 4

See also
	  begin	      returns an iterator to the beginning
	  (C++20)     (public member function)
	  end	      returns an iterator or a sentinel	to the end
	  (C++20)	     (public	    member	   function	    of
       std::ranges::lazy_split_view<V,Pattern>)

	  ranges::end returns a	sentinel indicating the	end of a range
	  (C++20)     (customization point object)

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

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

home | help