title: What is the difference between std::lower_bound and std::upper_bound?
body: <p>The code below does not compile with both MSVC2017 and GCC11:</p>
  <pre><code>#include &lt;deque&gt;
  #include &lt;chrono&gt;
  #include &lt;algorithm&gt;
  
  using Clock = std::chrono::system_clock;
  using TimePoint = std::chrono::time_point&lt;Clock&gt;;
  
  struct PricePoint
  {
      TimePoint dt;
      double buy;
      double sell;
  };
  
  inline bool operator &lt; (const TimePoint &amp; dt, const PricePoint &amp; a)
  {
      return a.dt &lt; dt;
  }
  
  int main()
  {
      std::deque&lt;PricePoint&gt; priceSequence;
      const auto begin = std::lower_bound(priceSequence.begin(), priceSequence.end(), Clock::now());
      return 0;
  }
  </code></pre>
  <p>But if I replace <code>std::lower_bound</code> with <code>std::upper_bound</code> it starts to compile. What is the difference?</p>