std::map::value_compare(3)

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

πŸ’… std::map::value_compare πŸ’…

Okay bestie, welcome to the C++ Standard Libary manual page for std::map::value_compare β€” yes, it's giving very specific function-object couture, and we're getting into it. πŸ’–

🌸 NAME 🌸

std::map::value_compare β€” std::map::value_compare

✨ Synopsis ✨

class value_compare;

std::map::value_compare is a function object that compares objects of type std::map::value_type (key-value pairs) by comparing the first components of the pairs.

πŸŽ€ Member types πŸŽ€

Type β†’ Definition, bestie:

  • result_type β€” bool (deprecated in C++17)(removed in C++20)
  • first_argument_type β€” value_type (deprecated in C++17)(removed in C++20)
  • second_argument_type β€” value_type (deprecated in C++17)(removed in C++20)

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

🧚 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::map<Key,T,Compare,Alloc>::value_compare::value_compare πŸ› οΈ

protected:
value_compare( Compare c );

Initializes the internal instance of the comparator to c.

🌸 Parameters 🌸

  • c β€” comparator to assign

πŸ¦‹ std::map<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.

🌸 Parameters 🌸

  • lhs, rhs β€” values to compare

πŸ“ Return value πŸ“

comp(lhs.first, rhs.first)

πŸ’€ Exceptions πŸ’€

May throw implementation-defined exceptions.


That's the whole page, bestie β€” mwah πŸ’‹. Source: http://cppreference.com Β· version/date: 2024.06.10.

πŸ“¦ where this page comes from