scope(exit) in C++11
I really like the scope(exit) statements in D. They allow you to keep the cleanup code next to the initialization code making it much easier to maintain and understand. I wish we had them in C++. Turns out this can be implemented easily using some of the new C++ features. …