Warning: std::find() is Broken!
summary
Claim: std::find’s specification omits the domain of equal so behavior depends on hidden preconditions, producing divergent results for cases like NaN not equal to NaN and failing examples that appear to “work” on some libraries but not others. Demonstrations use a buggy remove_if where a predicate copied resets counters, a fast Bresenham variant exploiting unsigned modulo arithmetic, and tooling evidence from clang static analyzer and UBSan. Result: implementations differ; fixes require explicit contract, stronger concepts, or documented invariants.
AI-written summary · about
chapters (34)
- 0:00Intro
- 0:56Welcome
- 3:24How Software Works
- 4:36Tony Hor
- 5:04Horlogic
- 6:59Math Symbols
- 10:27Static Analyzer
- 11:33Design by Contract
- 12:10Pre and Post Conditions
- 13:28Class Invariant
- 14:31Implementation Limitations
- 15:52Formal Methods
- 17:12Harshas Law
- 17:52Removing odd numbers
- 23:48Safety
- 24:37Safety definition
- 26:18Requirements for correctness
- 29:03Strong safety
- 29:57Undefined behaviour
- 30:51Example of undefined behaviour
- 33:40Weakening preconditions
- 34:11Is this a good thing
- 34:42Its complicated
- 35:40Line drawing algorithm
- 37:27accumulator
- 38:47modulo
- 39:51wrap around
- 42:53modular arithmetic
- 44:05behavior
- 45:26strong preconditions
- 48:44concepts
- 54:35guarantee
- 54:59distance
- 58:13random access requirements








