std::set::lower_bound(3)

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

πŸ¦‹ NAME πŸ¦‹

Okay bestie, welcome to std::set::lower_bound(3) from the C++ Standard Libary manual β€” yes, that's the manual name as written in the header, iconic typo energy πŸ™ˆπŸ’…. The name is literally:

std::set::lower_bound - std::set::lower_bound

No cap, that's the whole NAME situation. πŸŽ€


🌈 Synopsis 🌈

Here's the synopsis, copied exactly because code is sacred, bestie:

iterator lower_bound( const Key& key );             (1)
const_iterator lower_bound( const Key& key ) const; (2)
template< class K >                                 (3) (since C++14)
iterator lower_bound( const K& x );
template< class K >                                 (4) (since C++14)
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 to compare the elements to
  • x β€” alternative value that can be compared to 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.


⭐ Notes ⭐

The feature-test macro situation is giving:

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

🚧 Example 🚧

This section is incomplete.

Reason: no example


πŸ‘€ See also πŸ‘€

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

🧸 Category 🧸

  • Todo no example

Mwah πŸ’‹ β€” source/version is cppreference.com, date/version 2024.06.10, and this was the std::set::lower_bound(3) page. Bye bestie, go slay those iterators! πŸ«ΆπŸ‘‘

πŸ“¦ where this page comes from