Talk:cpp/algorithm/lower bound
>> The type Type1 must be such that an object of type T can be implicitly converted to Type1. The type Type2 must be such that an object of type ForwardIterator can be dereferenced and then implicitly converted to Type2.
I just tried to use lower_bound with a comparison function, libc++ as well as VS 2010 have this the other way around. I don't know where I would find the standard to check which way it's actually correct, but if 2 independent compilers agree I tend to believe that.
- You are correct, thanks for pointing out the error. The std reference is §25.4.3.1[lower.bound] and the comparison function of course is called as comp(*j, value) --Cubbi 08:01, 9 May 2012 (PDT)
[edit] No documentation of C++03/C++11 difference with regard to "ordered/partitioned according to cmp".
According to https://stackoverflow.com/questions/44881979/heterogeneous-containers-lookup-in-c98 , this page only documents the C++11 and onwards specification of lower_bound (I don't know whether that's correct. Please judge). It would be better if this documentation handled C++03 aswell. 79.218.64.137 02:37, 3 July 2017 (PDT)
[edit] Question on Example Code
In example code I am not able to understand why check for !comp(value, *first) is used along with first != last. What it tries to catch? Why first != last isn't sufficient? Can someone provide some example data? --Vpandya (talk) 23:11, 2 April 2018 (PDT)