std::flat_m...alue_compare(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ¦‹ std::flat_multimap::value_compare πŸ¦‹

okay bestie, welcome to the C++ Standard Library manual πŸ’– we're looking at std::flat_multimap::value_compare, and it's giving very niche-but-iconic comparator energy ✨


✨ NAME ✨

std::flat_multimap::value_compare β€” literally the std::flat_multimap::value_compare page, no cap 🫢

🌈 Synopsis 🌈

class value_compare;

(since C++23)

std::flat_multimap::value_compare is a function object that compares objects of type std::flat_multimap::const_reference (a pair of references to the stored key/value) by comparing the first components (i.e. keys) of the passed pairs. slay, keys only πŸ”‘

πŸŽ€ Member objects πŸŽ€

  • comp (private) β€” the comparison function object of type std::flat_multimap::key_compare (exposition-only member object*).

🌸 Member functions 🌸

  • constructor (private) β€” constructs a value_compare object; the page also labels it (public member function).
  • operator() β€” compares two values of type value_type (public member function).

πŸ› οΈ std::flat_multimap<Key,T,Compare,KeyContainer,MappedContainer>::value_compare::value_compare πŸ› οΈ

private:                         (exposition only*)
value_compare( key_compare c );

It initializes the underlying instance of the comparator comp to c. cute πŸ’…

πŸ’œ Parameters πŸ’œ

  • c β€” a comparator to assign.

πŸ”₯ std::flat_multimap<Key,T,Compare,KeyContainer,MappedContainer>::value_compare::operator() πŸ”₯

bool operator()( const const_reference& lhs, const const_reference& rhs ) const;

Compares lhs.first and rhs.first by calling the stored comparator comp. yes bestie, it's comparing the keys πŸ”‘

πŸ“ Parameters πŸ“

  • lhs, rhs β€” values to compare.

⭐ Return value ⭐

comp(lhs.first, rhs.first)

πŸ’€ Exceptions πŸ’€

May throw implementation-defined exceptions. dramatic, but that's what it says 😭


πŸ’– source/version: cppreference.com Β· date: 2024.06.10 Β· that's the whole page, mwah πŸ’–
πŸ“¦ where this page comes from