Skip to main content
Code Review

Timeline for Longest consecutive sequence of ascending, descending, or equal integers

Current License: CC BY-SA 4.0

7 events
when toggle format what by license comment
Aug 9, 2018 at 23:15 comment added Snowhawk Since sign is templated, you also have have to consider floating point types. How is NaN handled? Do we want the sign for signed zero or do we treat the value as the standard/IEEE format does (\$+0 == -0 == 0\$).
Aug 9, 2018 at 15:51 comment added Konrad Rudolph @TobySpeight Even better. Yes, is_same_sign is obviously wrong and entirely because I was misled by the original, wrong name.
Aug 9, 2018 at 15:45 comment added Toby Speight @Konrad is_same_sign would be very misleading - that would imply (a < 0) == (b < 0) && (0 < a) == (0 < b) or equivalent. This function is a cmp() implementation (aka operator<=>()).
Aug 9, 2018 at 15:17 comment added Deduplicator If you go to iterators, mind the details. Your code is needlessly inefficient for anything but RandomaccessIterators.
Aug 9, 2018 at 15:10 comment added Konrad Rudolph I really dislike the sign function’s name, because it isn’t the "sign" function, which has well-established semantics. Call it e.g. is_same_sign instead.
Aug 9, 2018 at 14:57 comment added papagaga @Snowhawk: hence the if (lss_end != last) ++lss_end; before the return statement.
Aug 9, 2018 at 14:00 history answered papagaga CC BY-SA 4.0

AltStyle によって変換されたページ (->オリジナル) /