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

FreeBSD Manual Pages

  
 
  

home | help
std::basic_..._view::swap(3)  C++ Standard Libary std::basic_..._view::swap(3)

NAME
       std::basic_string_view::swap - std::basic_string_view::swap

Synopsis
	  constexpr void swap( basic_string_view& v ) noexcept;	 (since	C++17)

	  Exchanges the	view with that of v.

Parameters
	  v - view to swap with

Return value
	  (none)

Complexity
	  Constant.

Example
       // Run this code

	#include <string_view>
	#include <iostream>

	int main() {
	    auto s1{ std::string_view{""} };
	    auto s2{ std::string_view{""} };

	    std::cout << "Before : " <<	s1 << '	' << s2	<< "\n";
	    s1.swap(s2);
	    std::cout << "After	 : " <<	s1 << '	' << s2	<< "\n";
	}

Output:
	Before :
	After  :

See also
	  swap	      swaps the	values of two objects
		      (function	template)
	  swap_ranges swaps two	ranges of elements
		      (function	template)
	  swap	      swaps the	contents
		      (public	    member	function      of      std::ba-
       sic_string<CharT,Traits,Allocator>)

http://cppreference.com		  2022.07.31	  std::basic_..._view::swap(3)

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

home | help