Acadaniket_1729's blog

By Acadaniket_1729, history, 13 months ago, In English

The terms "lower bound" and "upper bound" come from the mathematical concept of intervals and are used in computer science to refer to the two endpoints of a range.

In the case of the C++ Standard Library functions lower_bound and upper_bound, these endpoints are the first element in a range that is not less than (i.e., greater than or equal to) a given value, and the first element in a range that is strictly greater than a given value, respectively.

The terms "lower" and "upper" are used because they convey the idea that the endpoints of the range can be thought of as the "lower" and "upper" limits of the values that fall within the range. This terminology is consistent with the use of the terms in mathematics, where the lower bound and upper bound of an interval define the smallest and largest values that belong to the interval.

By using the terms "lower_bound" and "upper_bound" to name these functions, the C++ Standard Library is making a connection to the mathematical concept of intervals and making it clear that these functions are designed to work with sorted ranges of values.

  • Vote: I like it
  • -28
  • Vote: I do not like it

»
13 months ago, # |
  Vote: I like it +9 Vote: I do not like it

Is that you, gpt?