std::map::upper_bound(3)

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

πŸ¦‹ std::map::upper_bound(3) β€” C++ Standard Libary πŸ¦‹

okay so bestie, welcome to the std::map::upper_bound(3) page from the C++ Standard Libary. It's giving very specific, very useful, and honestly kinda iconic once you get the vibe. Let's go πŸ’…


🌸 NAME

std::map::upper_bound β€” literally std::map::upper_bound. That's the name, bestie, no plot twist ✨


πŸ“œ Synopsis

iterator upper_bound( const Key& key );             (1)
const_iterator upper_bound( const Key& key ) const; (2)
template< class K >                                 (3) (since C++14)
iterator upper_bound( const K& x );
template< class K >                                 (4) (since C++14)
const_iterator upper_bound( const K& x ) const;

1,2) β€” Returns an iterator pointing to the first element that is greater than key.

3,4) β€” Returns an iterator pointing to the first element that compares greater 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 to compare the elements to.
  • x β€” alternative value that can be compared to Key.

🎁 Return value

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


⚑ Complexity

Logarithmic in the size of the container. No cap, that's the whole vibe check πŸ”₯


πŸ“ Notes

Feature-test macro tea β˜•:

  • Feature-test macro: __cpp_lib_generic_associative_lookup
  • Value: 201304L
  • Std: (C++14)
  • Feature: Heterogeneous comparison lookup in associative containers, for overloads (3,4)

πŸ’– Example

This section is incomplete Reason: no example

Not me finding an incomplete example section 😭 but that's literally what it says.


πŸ‘€ See also

  • equal_range β€” returns range of elements matching a specific key (public member function)
  • lower_bound β€” returns an iterator to the first element not less than the given key (public member function)

πŸ—‚οΈ Category

  • Todo no example

sleep tight bestie πŸ’œ β€” source: http://cppreference.com; version/date: 2024.06.10; manual: std::map::upper_bound(3).

πŸ“¦ where this page comes from