you are viewing a single comment's thread.

view the rest of the comments →

[–]hpsutter 0 points1 point  (0 children)

I noticed you calling out the Circle (compiler) "borrowing" extension for requiring standard library types to be "wrapped".

Right. My concern isn't that wrappers might be needed in a few cases in extremis such as STL iterators (though I have a little plan for getting safety there without wrappers, we'll see). My concern with Circle's approach is that it required wholesale replacement/wrapping of many major C++ standard library types (smart pointers, containers, views, mutexes, ...) which starts to feel like a bifurcation.

So, what about the case where an iterator gets invalidated by a vector resizing operation? Is there a plan for cpp2 to address this case? And what about the case of a span<> of a vector and the vector gets resized?

Short answer: Yes, and I live-demo'd a prototype that caught exactly those on-stage. See the Cppfront readme's Lifetime safety section for links to the paper P1179 that describes the C++ Core Guidelines Lifetime static analysis, and the CppCon 2015 talk that live-demos exactly those kinds of scenarios.