std::multim...lue_compare(3)

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

✨ std::multimap::value_compare ✨

Okay bestie, this is the C++ Standard Libary page for std::multimap::value_compare, and it's giving very specific comparator energy β€” no cap πŸ’…


🌸 NAME 🌸

std::multimap::value_compare β€” std::multimap::value_compare

Yes, it's the same on both sides of the dash. We're keeping it. Iconic.

✨ Synopsis ✨

class value_compare;

std::multimap::value_compare is a function object that compares objects of type std::multimap::value_type (key-value pairs) by comparing of the first components of the pairs. That's the whole vibe: function object, key-value pairs, first components first πŸ”₯

🌈 Member types 🌈

Type-to-definition mapping, bestie:

  • result_type β€” deprecated in C++17, removed in C++20 β€” maps to bool
  • first_argument_type β€” deprecated in C++17, removed in C++20 β€” maps to value_type
  • second_argument_type β€” deprecated in C++17, removed in C++20 β€” maps to value_type

These member types are obtained via publicly inheriting (until C++11) std::binary_function<value_type, value_type, bool>. Periodt.

πŸ¦‹ Protected member objects πŸ¦‹

  • Compare comp β€” the stored comparator (protected member object) 🫢

πŸŽ€ Member functions πŸŽ€

  • constructor β€” constructs a new value_compare object (protected member function)
  • operator() β€” compares two values of type value_type (public member function)

🧚 std::multimap<Key,T,Compare,Alloc>::value_compare::value_compare 🧚

protected:
value_compare( Compare c );

It initializes the internal instance of the comparator to c. Cute, protected, very VIP.

πŸ’– Parameters πŸ’–

  • c β€” comparator to assign

πŸ”₯ std::multimap<Key,T,Compare,Alloc>::value_compare::operator() πŸ”₯

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

Compares lhs.first and rhs.first by calling the stored comparator. Main character comparator behavior, honestly πŸ’…

πŸ’– Parameters πŸ’–

  • lhs, rhs β€” values to compare

πŸ“ Return value πŸ“

comp(lhs.first, rhs.first)

πŸ’€ Exceptions πŸ’€

May throw implementation-defined exceptions. So like, don't assume it's chill in every implementation, bestie 😭


Footer source/version/date sign-off, because we do not leave the footer hanging: http://cppreference.com Β· 2024.06.10 Β· std::multim...lue_compare(3) β€” bye bestie, mwah πŸ’‹πŸ«Ά

πŸ“¦ where this page comes from