unique_ptr<>, scoped_ptr<>, and shared_ptr<> all say different things about heap memory lifetime, and those make it easier to maintain your grasp on what you're asking the computer to do.
Like many things in C++, you can do that in C too (e.g. by using a variant of Hungarian notation). But the important thing is to do it.
Rust's memory management works similarly to what you describe in C++[0], but things like unique_ptr, et al. are baked into the syntax and compiler. -- It's basically syntactic sugar for memory semantics.
Coming from a background of GC'd languages (Java, Go, and Ruby) these different allocation semantics were Very Hard(TM) for me to understand at first. I kept battling w/ the type checker, throwing different pointer types at it until the example compiled. (Rust's compiler is _very_ intelligent, w/o using "unsafe" code, you basically cannot have a "use after free" condition in Rust. -- It will not compile.)
As the parent points out: I've never really spent any length of time _understanding_ the allocations I'm asking a computer to make. I just generate things, they become garbage, and the runtime cleans it up eventually.
Once Rust "clicked" for me, I realized something: I know the lifetime of _every single variable_ in this piece of code.
I know when it's allocated, where it's allocated, and when it gets freed.
The reason it was so hard for me to initially grok Rust was because I'm _not used to reasoning_ about memory allocation.
Once I understood the semantics though, it was as though I had an _entirely new_ level of abstraction at my fingertips.
These semantics are definitely some powerful stuff, and I'm very glad I'm taking the time to try and understand them.
[0]: http://pcwalton.github.com/blog/2013/03/18/an-overview-of-me...
Suddenly you have distributed knowledge across team members with various skill levels and producing memory leaks is very easy.
Nowadays automatic memory management in the form of GC or reference counting is the way to go.
There's literally only ever one "owner" of a unique_ptr, which is why the parent comment talked about taking it from somewhere.
C++ exchanges ownership of unique_ptr's in the move constructor or assignment operator (i.e. there's no "copy" operation available, unlike with std::auto_ptr). If a unique_ptr still happens to own a pointer when the unique_ptr is destructed, it knows to destroy the pointed-to object as well and free the memory, but the object itself is not reference-counted per se, there's only the Boolean sense "alive/dead".
MOV EAX, EBP
XOR EBP, EBP
is "reference counting".