std::multiset::upper_bound(3)

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

🌸 NAME 🌸

Okay so this page is literally titled std::multiset::upper_bound(3), and it lives in the C++ Standard Libary manual, section 3. That's the whole vibe: one member function, four overloads, zero chill. πŸ’… Not me being obsessed with a lookup function, but here we are.

πŸŽ€ Synopsis πŸŽ€

Here's the synopsis, bestie β€” code copied exactly, no cap, because we do not mess with literals. ✨

          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. (1), (2) β€” returns an iterator pointing to the first element that is greater than key.
  2. (3), (4) (since C++14) β€” 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 πŸ¦‹

Two little parameters, both iconic:

  • key β€” key value to compare the elements to.
  • x β€” alternative value that can be compared to Key.

πŸ’– Return value πŸ’–

An iterator pointing to the first element that is greater than key. If no such element is found, the past-the-end iterator (see end()) is returned. That's the whole return-value story, fr fr. 🫢

πŸ”₯ Complexity πŸ”₯

Logarithmic in the size of the container. Lowkey elegant, highkey iconic. ⭐

🌈 Notes 🌈

Feature-test macro tea, coming right up β˜•:

  • 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 showing up to the example section and finding it empty 😭.

πŸ‘€ See also πŸ‘€

Other functions in the multiset cinematic universe πŸ‘‘:

  • 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

And that's the whole page, bestie. Big kiss from http://cppreference.com, dated 2024.06.10. πŸ’–βœ¨

πŸ“¦ where this page comes from