Skip to main content

std::map value_compare

class value_compare;

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

Member types

pub
Type
Definition
pubresult_type (deprecated in C++17) (removed in C++20)bool
pubfirst_argument_type (deprecated in C++17) (removed in C++20)value_type
pubsecond_argument_type (deprecated in C++17) (removed in C++20)value_type
These member types are obtained via publicly inheriting std::binary_function<value_type, value_type, bool>.

Protected member objects

protCompare compthe stored comparator

Member functions

prot(constructor)constructs a new value_compare object
protected:
value_compare( Compare c );

Initializes the internal instance of the comparator to c.

Parameters

  • c - comparator to assign
puboperator()compares two values of type value_type
// Const version only
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.

This article originates from this CppReference page. It was likely altered for improvements or editors' preference. Click "Edit this page" to see all changes made to this document.
Hover to see the original license.

std::map value_compare

class value_compare;

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

Member types

pub
Type
Definition
pubresult_type (deprecated in C++17) (removed in C++20)bool
pubfirst_argument_type (deprecated in C++17) (removed in C++20)value_type
pubsecond_argument_type (deprecated in C++17) (removed in C++20)value_type
These member types are obtained via publicly inheriting std::binary_function<value_type, value_type, bool>.

Protected member objects

protCompare compthe stored comparator

Member functions

prot(constructor)constructs a new value_compare object
protected:
value_compare( Compare c );

Initializes the internal instance of the comparator to c.

Parameters

  • c - comparator to assign
puboperator()compares two values of type value_type
// Const version only
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.

This article originates from this CppReference page. It was likely altered for improvements or editors' preference. Click "Edit this page" to see all changes made to this document.
Hover to see the original license.