2

I noticed the non-ranges version requires that the compare predicate is a BinaryPredicate [alg.sorting.general.2], but the ranges version requires std::indirect_strict_weak_order [lower.bound] (which bans me to use less_equal).

I searched stackoverflow but only found a question about whether there's a difference, also none of the answerer explained why there's a difference. So I open this question hoping to figure this out.

FeignClaims
  • 193
  • 8
  • 1
    Using `less_equal` as a comparator doesn't make sense. Why do you want to use it? – interjay Jun 08 '23 at 11:15
  • @interjay I writed a [function](https://godbolt.org/z/bWTj14938) to count the longest increasing (`less`) subsequence in a range, and noticed the change to generalize it in order to count the longest *pred* subsequence in a range (which should apply to `less_equal`). That's where I noticed the different requirements between non-range and range version. – FeignClaims Jun 09 '23 at 14:25

0 Answers0