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

FreeBSD Manual Pages

  
 
  

home | help
std::flat_m...set::extract(3) C++ Standard Libarystd::flat_m...set::extract(3)

NAME
       std::flat_multiset::extract - std::flat_multiset::extract

Synopsis
	  container_type extract() &&;	(since C++23)

	  Extracts adapted container c.	Equivalent to return std::move(c);.

	  After	this operation *this is	empty, even if an exception is thrown.

Parameters
	  (none)

Return value
	  std::move(c).

Complexity
	  Constant.

Example
       // Run this code

	#include <cassert>
	#include <flat_set>
	#include <print>
	#include <type_traits>
	#include <vector>

	int main()
	{
	    std::flat_multiset<int> set{1, 2, 3};
	    const auto size = set.size();

	    auto c = set.extract();
	    assert(c.size() == size);
	    assert(set.empty());
	    assert(set.keys().empty());
	    assert(set.values().empty());

	    // The default keys	container is std::vector:
	    static_assert(std::is_same_v<decltype(c), std::vector<int>>);

	    std::println("{}", c);
	}

Output:
	[1, 2, 3]

See also
	  replace replaces the underlying container
		  (public member function)

http://cppreference.com		  2024.06.10	 std::flat_m...set::extract(3)

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

home | help