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

FreeBSD Manual Pages

  
 
  

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

NAME
       std::experimental::ranges::sort - std::experimental::ranges::sort

Synopsis
	  Defined in header <experimental/ranges/algorithm>
	  template< RandomAccessIterator I, Sentinel<I>	S,

	  class	  Comp	 =  ranges::less<>,  class  Proj  =  ranges::identity>
       (1) (ranges TS)
	  requires Sortable<I, Comp, Proj>

	  I sort( I first, S last, Comp	comp = Comp{}, Proj proj = Proj{} );
	  template< RandomAccessRange R,

	  class	Comp = ranges::less<>, class Proj = ranges::identity>
	  requires	Sortable<ranges::iterator_t<R>,	     Comp,	 Proj>
       (2) (ranges TS)

	  ranges::safe_iterator_t<R> sort( R&& r, Comp comp = Comp{}, Proj
	  proj = Proj{}	);

	  1) Sorts the elements	in the range [first, last) in ascending	order.
       The order of
	  equal	 elements is not guaranteed to be preserved. Elements are com-
       pared using comp
	  after	applying the projection	proj.
	  2)  Sorts  the  elements  in	the  range  r,	 as   if   by	return
       ranges::sort(ranges::begin(r),
	  ranges::end(r), comp,	proj);

	  Notwithstanding  the	declarations depicted above, the actual	number
       and order of
	  template parameters for algorithm declarations is unspecified. Thus,
       if explicit
	  template arguments are used when calling an algorithm,  the  program
       is probably
	  non-portable.

Parameters
	  first, last -	the range of elements to sort
	  r	      -	the range of elements to sort
	  comp	      -	the comparator to use
	  proj	      -	the projection to apply	to elements in the range

Return value
	  An  iterator	pointing  past the end of the range (i.e., it compares
       equal to	last for
	  overload (1),	and ranges::end(r) for overload	(2)).

Complexity
	  O(Nlog(N)) comparisons, where	N is equal to the number  of  elements
       in the range.

Example
	   This	section	is incomplete
	   Reason: no example

See also
	  sort sorts a range into ascending order
	       (function template)

http://cppreference.com		  2022.07.31	 std::experi...ranges::sort(3)

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

home | help