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

FreeBSD Manual Pages

  
 
  

home | help
std::experi...es::exchange(3) C++ Standard Libarystd::experi...es::exchange(3)

NAME
       std::experimental::ranges::exchange   -	std::experimental::ranges::ex-
       change

Synopsis
	  Defined in header <experimental/ranges/utility>
	  template< MoveConstructible T, class U = T >

	  requires			Assignable<T&,			    U>
       (ranges TS)

	  constexpr T exchange(T& obj, U&& new_val) noexcept(/*	see below */);

	  Replaces  the	 value of obj with new_value and returns the old value
       of obj, as if by

	T old_value = std::move(obj);
	obj = std::forward<U>(new_value);
	return old_value;

Parameters
	  obj	    - object whose value to replace
	  new_value - the value	to assign to obj

Return value
	  The old value	of obj

Exceptions
	  noexcept specification:
	  noexcept(std::is_nothrow_move_constructible<T>::value	&&
	  std::is_nothrow_assignable<T&, U>::value)

Example
	   This	section	is incomplete
	   Reason: no example

See also
	  exchange replaces the	argument with a	new value and returns its pre-
       vious value
	  (C++14)  (function template)

http://cppreference.com		  2022.07.31	 std::experi...es::exchange(3)

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

home | help