Talk:cpp/algorithm/search n
The possible implementation here does not look correct. First, if the range is smaller than 'count', then 't_last' will not be correct. Also, in the inner loop, there is no guarantee that 'first' doesnt go past 't_last' but not return, and then the outer for-loop will not exit correctly. -- jaredgrubb
- I agree that it looks a little funny. Would you like to take a whack at fixing it? :) --Nate (talk) 20:20, 7 September 2013 (PDT)
- Sure and I hope it's right now; at the very least, it no longer has those defects :) Jaredgrubb (talk) 09:14, 8 September 2013 (PDT)
Can somebody help? What should happen if Size is a floating point type? The draft says "The type Size shall be convertible to integral type", but the description of the Result doesn't imply a conversion is necessary. The wording is "for every non-negative integer n less than count the following corresponding conditions hold", such as if count==1.3 should act the same as count==2. This is not what GCC9.0.1 201902 does however. It converts count down to integer, claims to expect and integer, and even loops forever when 0<count<1 i.e. does not support floats at all. If someone has understanding of the draft language, pls help. -- User:edg