OK, so you can't use references. Then, as I said before, your pointer replacements have a runtime performance cost worse than GC write barriers.
> Yes, that series of operations is safe. A related example from the "msetl_example.cpp" file:
I don't think you understood me. I mean the this pointer. "this" is hardwired into C++ to be an unsafe pointer.
> I agree with the gist though. This kind of thing should be prevented at compile time. Rust has an excellent static analyzer/enforcer built into its compiler. Arguably, it would be a service to the community to unbundle it from the Rust compiler and make it available for application to C++ code as well. Arguably.
Not possible. It's totally incompatible with existing C++ designs.
> Um, yeah, modern code should try to avoid the use of general pointers (and generally does). Most modern languages don't provide general pointers.
I think you're getting lost in the weeds of what a "general pointer" is and is not. It doesn't matter.
The point is that if your references track their owners at runtime, then you are just creating a GC. If the overhead of doing that is worse than a traditional GC (which, if you are doing that much bookkeeping, it will be), then there's little purpose to it.