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

FreeBSD Manual Pages

  
 
  

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

NAME
       std::experimental::ranges::swap - std::experimental::ranges::swap

Synopsis
	  Defined in header <experimental/ranges/utility>
	  namespace {

	      constexpr	/* unspecified */ swap = /* unspecified	  (ranges TS)
	  */;							   (customiza-
       tion point object)

	  }
	  Call signature
	  template< class T, class U >

	      requires /* see below */

	  void swap( T&& t, U&&	u ) noexcept(/*	see below */);

	  Exchanges the	values referenced by t and u.

	  A call to ranges::swap is equivalent to:

	  1) (void)swap(std::forward<T>(t), std::forward<U>(u)), if  that  ex-
       pression	is valid,
	  where	the overload resolution	is performed with the following	candi-
       dates:
	    * template<class T>	void swap(T&, T&) = delete;
	    *  template<class  T, std::size_t N> void swap(T(&)[N], T(&)[N]) =
       delete;
	    * any declarations of swap found by	argument-dependent lookup.
	  If the function selected by overload resolution  does	 not  exchange
       the values
	  referenced  by t and u, the program is ill-formed; no	diagnostic re-
       quired.
	  2) Otherwise,	(void)ranges::swap_ranges(t, u), if T and U are	lvalue
       references to
	  array	types of equal extent (but possibly different  element	types)
       and
	  ranges::swap(*t, *u) is a valid expression.
	  3)  Otherwise, if T and U are	both V&	for some type V	that meets the
       syntactic
	  requirements of  MoveConstructible<V>	 and  Assignable<V&,  V>,  ex-
       changes the referenced
	  values   as	if  by	V  v{std::move(t)};  t	=  std::move(u);  u  =
       std::move(v);. If the
	  semantic requirements	of either concept are not satisfied, the  pro-
       gram is
	  ill-formed; no diagnostic required.
	  4) In	all other cases, a call	to ranges::swap	is ill-formed.

	  ranges::swap	can be used in a constant expression if	every function
       it calls	(as
	  specified above) can be so used.

Exceptions
	  1)
	  noexcept specification:
	  noexcept(noexcept((void)swap(std::forward<T>(t),	     std::for-
       ward<T>(u))))
	  , where swap is found	as described above.
	  2)
	  noexcept specification:
	  noexcept(noexcept(ranges::swap(*t, *u)))
	  3)
	  noexcept specification:
	  noexcept(std::is_nothrow_move_constructible<V>::value	&&
		   std::is_nothrow_move_assignable<V>::value)

Example
	   This	section	is incomplete
	   Reason: no example

See also
	  swap swaps the values	of two objects
	       (function template)

Categories:
	    * conditionally noexcept
	    * Todo no example

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

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

home | help