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

FreeBSD Manual Pages

  
 
  

home | help
std::flat_multimap(3)	      C++ Standard Libary	 std::flat_multimap(3)

NAME
       std::flat_multimap - std::flat_multimap

Synopsis
	  Defined in header <flat_map>
	  template<

	      class Key,
	      class T,
	      class Compare = std::less<Key>,	      (since C++23)
	      class KeyContainer = std::vector<Key>,
	      class MappedContainer = std::vector<T>

	  > class flat_multimap;

	  The  flat multimap is	a container adaptor that gives the functional-
       ity of an
	  associative container	that contains key-value	pairs,	while  permit-
       ting multiple
	  entries  with	 the same key value. Keys are sorted by	using the com-
       parison function
	  Compare.

	  The class template flat_multimap acts	as a wrapper to	the two	under-
       lying containers,
	  passed as objects of type KeyContainer and  MappedContainer  respec-
       tively. The first
	  container  is	sorted,	and for	each key its corresponding value is in
       the second
	  container at the same	index (offset).	The number of elements in both
       containers is
	  the same.

	  Everywhere the  standard  library  uses  the	Compare	 requirements,
       uniqueness is
	  determined  by  using	 the equivalence relation. Informally, two ob-
       jects a and b are
	  considered equivalent	if  neither  compares  less  than  the	other:
       !comp(a,	b) &&
	  !comp(b, a).

	  std::flat_multimap  meets the	requirements of	Container, Reversible-
       Container,
	  optional container requirements, and all  requirements  of  Associa-
       tiveContainer
	  (including logarithmic search	complexity), except that:

	    * requirements related to nodes are	not applicable,
	    * iterator invalidation requirements differ,
	    * the complexity of	insertion and erasure operations is linear.

	  A flat multimap supports most	AssociativeContainer's operations that
       use equal keys.

Template parameters
	  Key		  - The	type of	the keys. The program is ill-formed if
       Key is not the
			    same type as KeyContainer::value_type.
	  T		   -  The  type	 of mapped values. The program is ill-
       formed if T is not
			    the	same type as MappedContainer::value_type.
	  Compare	  - A Compare type providing a strict weak ordering.
			    The	types of the underlying	 SequenceContainer  to
       store keys and
			    mapped  values  correspondingly.  The iterators of
       such containers
			    should satisfy LegacyRandomAccessIterator or model
	  KeyContainer	  - random_access_iterator. Invocations	of their  mem-
       ber functions size
	  MappedContainer   and	max_size should	not exit via an	exception.

			    The	standard containers std::vector	and std::deque
       satisfy these
			    requirements.

Member types
	  Member type		 Definition
	  key_container_type	 KeyContainer
	  mapped_container_type	 MappedContainer
	  key_type		 Key
	  mapped_type		 T
	  value_type		 std::pair<key_type, mapped_type>
	  key_compare		 Compare
	  reference		 std::pair<const key_type&, mapped_type&>
	  const_reference	      std::pair<const	  key_type&,	 const
       mapped_type&>
	  size_type		 std::size_t
	  difference_type	 std::ptrdiff_t
	  iterator		  implementation-defined   LegacyInputIterator
       and
				 random_access_iterator	to value_type
	  const_iterator	   implementation-defined  LegacyInputIterator
       and
				 random_access_iterator	to const value_type
	  reverse_iterator	 std::reverse_iterator<iterator>
	  const_reverse_iterator std::reverse_iterator<const_iterator>
				 type describing the underlying	containers

				 struct	containers
	  containers		 {
				     key_container_type	keys;
				     mapped_container_type values;
				 };

Member classes
	  value_compare	compares objects of type value_type
			(class)

Member objects
	  Member name	    Definition
	  c (private)	    the	object of type containers
			    (exposition-only member object*)
	  compare (private) the	comparison function object of type key_compare
			    (exposition-only member object*)

Member functions
	  constructor		constructs the flat_multimap
				(public	member function)
	  destructor		destroys every element of the container	 adap-
       tor
	  (implicitly declared)	(public	member function)
	  operator=		assigns	values to the container	adaptor
				(public	member function)

Iterators
	  begin			returns	an iterator to the beginning
	  cbegin		(public	member function)
	  end			returns	an iterator to the end
	  cend			(public	member function)
	  rbegin		returns	a reverse iterator to the beginning
	  crbegin		(public	member function)
	  rend			returns	a reverse iterator to the end
	  crend			(public	member function)

Capacity
	  empty			checks whether the container adaptor is	empty
				(public	member function)
	  size			returns	the number of elements
				(public	member function)
	  max_size		 returns  the  maximum possible	number of ele-
       ments
				(public	member function)

Modifiers
	  emplace		constructs element in-place
				(public	member function)
	  emplace_hint		constructs elements in-place using a hint
				(public	member function)
	  insert		inserts	elements
				(public	member function)
	  insert_range		inserts	a range	of elements
				(public	member function)
	  extract		extracts the underlying	containers
				(public	member function)
	  replace		replaces the underlying	containers
				(public	member function)
	  erase			erases elements
				(public	member function)
	  swap			swaps the contents
				(public	member function)
	  clear			clears the contents
				(public	member function)

Lookup
	  find			finds element with specific key
				(public	member function)
	  count			returns	the number of elements	matching  spe-
       cific key
				(public	member function)
	  contains		 checks	if the container contains element with
       specific	key
				(public	member function)
				returns	an iterator to the first  element  not
       less than the
	  lower_bound		given key
				(public	member function)
				returns	 an  iterator  to  the	first  element
       greater than the
	  upper_bound		given key
				(public	member function)
	  equal_range		returns	range of elements matching a  specific
       key
				(public	member function)

Observers
	  key_comp		returns	the function that compares keys
				(public	member function)
				returns	the function that compares keys	in ob-
       jects of	type
	  value_comp		value_type
				(public	member function)
	  keys			direct access to the underlying	keys container
				(public	member function)
	  values		 direct	 access	 to the	underlying values con-
       tainer
				(public	member function)

Non-member functions
	  operator==			lexicographically compares the	values
       of two
	  operator<=>			flat_multimaps
	  (C++23)			(function template)
	  std::swap(std::flat_multimap)	specializes the	std::swap algorithm
	  (C++23)			(function template)
	  erase_if(std::flat_multimap)	 erases	 all  elements satisfying spe-
       cific criteria
	  (C++23)			(function template)

Helper classes
	  std::uses_allocator<std::flat_multimap>	specializes	   the
       std::uses_allocator type
	  (C++23)				  trait
						  (class  template specializa-
       tion)

	  Tags

	  sorted_equivalent   indicates	that elements of a  range  are	sorted
       (uniqueness is not
	  sorted_equivalent_t required)
	  (C++23)	      (tag)

	  Deduction guides

Notes
	  The  member  types iterator and const_iterator may be	aliases	to the
       same type. This
	  means	defining a pair	of function overloads using the	two  types  as
       parameter types
	  may  violate	the One	Definition Rule. Since iterator	is convertible
       to
	  const_iterator, a single function with a const_iterator as parameter
       type will work
	  instead.

	  Feature-test macro  Value    Std		   Feature
	  __cpp_lib_flat_map 202207L (C++23) std::flat_map and	std::flat_mul-
       timap

Example
	   This	section	is incomplete
	   Reason: no example

See also
	  flat_map	      adapts two containers to provide a collection of
       key-value pairs,
	  (C++23)	     sorted by unique keys
			     (class template)
	  multimap	     collection	of key-value pairs, sorted by keys
			     (class template)
	  unordered_multimap collection	of key-value pairs, hashed by keys
	  (C++11)	     (class template)

Categories:
	    * Todo without reason
	    * Todo no example

http://cppreference.com		  2024.06.10		 std::flat_multimap(3)

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

home | help