Contracts are part of the memory safety story in c++
interesting. how would I use contracts to avoid returning (or passing to a function that can persist the value) a span or string_view that refers to local or temporary value? or a lambda that captures such value by reference?
> Contracts are part of the memory safety story in c++
Contracts are an optional debugging tool. They are literally designed to assert pre and post conditions. They are no better than the assert macro in asserting memory safety.
And that’s exactly why they’re so controversial. As adopted by the committee they do not do anything to provide memory safety.
The pushback from the final rejection got the committee to add the bare minimum that could help C++’s safety story.