home | help
deductiongu...es::subrange(3)  C++ Standard Libary deductiongu...es::subrange(3)

NAME
     deductionguidesforstd::ranges::subrange	      - 	deductionguides-
     forstd::ranges::subrange

Synopsis
	Defined in header <ranges>
	template<  std::input_or_output_iterator  I,  std::sentinel_for<I>  S  >
     (1) (since
	subrange(I,	      S)	   ->		subrange<I,	     S>;
     C++20)
	template< std::input_or_output_iterator I, std::sentinel_for<I> S >
										     (since
	subrange(I, S,	/*make-unsigned-like-t*/<std::iter_difference_t<I>>)  ->
     (2) C++20)

	    subrange<I, S, ranges::subrange_kind::sized>;
	template< ranges::borrowed_range<R> >

	subrange(R&&) ->
	    subrange<ranges::iterator_t<R>, ranges::sentinel_t<R>,
		     (ranges::sized_range<R>				      ||
     (3) (since
		      std::sized_sentinel_for<ranges::sentinel_t<R>,
     C++20)
		      ranges::iterator_t<R>>) ?

		     ranges::subrange_kind::sized :
	ranges::subrange_kind::unsized>;
	template< ranges::borrowed_range<R> >

	subrange(R&&,	/*make-unsigned-like-t*/<ranges::range_difference_t<R>>)
     (since
	->
     (4) C++20)
	    subrange<ranges::iterator_t<R>, ranges::sentinel_t<R>,

		     ranges::subrange_kind::sized>;

	These deduction guides are provided for std::ranges::subrange.

	1)  Deduces  the  template  arguments from the type of iterator and sen-
     tinel. The
	subrange is sized if std::sized_sentinel_for<S, I> is satisfied, as  de-
     termined by
	the default template argument.
	2)  Deduces  the  template  arguments from the type of iterator and sen-
     tinel, while the
	size of range is specified. The subrange is always sized.
	3) Deduces the template arguments from the type of range.  The	subrange
     is sized if
	the size can be obtained from the range or its iterator and sentinel.
	4) Deduces the template arguments from the type of range, while the size
     of range is
	specified. The subrange is always sized.

	The  exposition-only alias template make-unsigned-like-t maps each inte-
     ger-like type
	to its corresponding unsigned version.

Notes
	While constructing the subrange object,

	  * for (1,2), the behavior is undefined if the  iterator-sentinel  pair
     does not
	    denote a valid range,
	  *  for (2,4), the behavior is undefined if the given size is not equal
     to the size
	    of the range.

Example
	 This section is incomplete
	 Reason: no example

	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  3404 C++20      meaningless deduction guides from pair-like     re-
     moved
			    types were provided

Category:
	  * Todo no example

http://cppreference.com 	   2024.06.10	   deductiongu...es::subrange(3)

home | help