Skip to main content

std::multimap lower_bound() method

// (1) Non const version
iterator lower_bound( const Key& key );

// (2) Const version
const_iterator lower_bound( const Key& key ) const;

// (3) Non const version
template< class K >
iterator lower_bound( const K& x );

// (4) Const version
template< class K >
const_iterator lower_bound( const K& x ) const;
  • (1-2) Returns an iterator pointing to the first element that is not less than (i.e. greater or equal to) key.
  • (3,4) Returns an iterator pointing to the first element that compares not less (i.e. greater or equal) to the value x. This overload participates in overload resolution only if the qualified-id Compare::is_transparent is valid and denotes a type. It allows calling this function without constructing an instance of Key.

Parameters

  • key - key value of the elements to count
  • x - a value of any type that can be transparently compared with a key

Return value

Iterator pointing to the first element that is not less than key. If no such element is found, a past-the-end iterator (see end()) is returned.

Complexity

Logarithmic in the size of the container - O(log size()).

Exceptions

(none)

Notes

Feature testing macro: __cpp_lib_generic_associative_lookup (for overloads (3) and (4)).

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::multimap lower_bound() method

// (1) Non const version
iterator lower_bound( const Key& key );

// (2) Const version
const_iterator lower_bound( const Key& key ) const;

// (3) Non const version
template< class K >
iterator lower_bound( const K& x );

// (4) Const version
template< class K >
const_iterator lower_bound( const K& x ) const;
  • (1-2) Returns an iterator pointing to the first element that is not less than (i.e. greater or equal to) key.
  • (3,4) Returns an iterator pointing to the first element that compares not less (i.e. greater or equal) to the value x. This overload participates in overload resolution only if the qualified-id Compare::is_transparent is valid and denotes a type. It allows calling this function without constructing an instance of Key.

Parameters

  • key - key value of the elements to count
  • x - a value of any type that can be transparently compared with a key

Return value

Iterator pointing to the first element that is not less than key. If no such element is found, a past-the-end iterator (see end()) is returned.

Complexity

Logarithmic in the size of the container - O(log size()).

Exceptions

(none)

Notes

Feature testing macro: __cpp_lib_generic_associative_lookup (for overloads (3) and (4)).

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.