In the transaction example, if this were C++, we could probably make the actual destructor private, and then have commit() and rollback() functions take the transaction object by rvalue reference (needs a layer of unique_ptr here). What am I missing? Is this a problem because it forces unique_ptr?
Almost, but see the replies to IcyWindows' comment for why this unfortunately doesn't work in C++. Also, I would love it if C++ had a way to actually move. That would unlock all sorts of interesting possibilities.