Here’s my article in the April 2015 issue of MSDN Magazine:
Visual C++ 2015 Brings Modern C++ to Legacy Code
Systems programming with Windows relies heavily on opaque handles that represent objects hidden behind C-style APIs. Unless you’re programming at a fairly high level, chances are you’ll be in the business of managing handles of various kinds. The concept of a handle exists in many libraries and platforms and is certainly not unique to the Windows OS. I first wrote about a smart handle class template back in 2011 when Visual C++ started introducing some initial C++11 language features. Visual C++ 2010 made it possible to write convenient and semantically correct handle wrappers, but its support for C++11 was minimal and a lot of effort was still required to write such a class correctly. With the introduction of Visual C++ 2015 this year, I thought I’d revisit this topic and share some more ideas about how to use modern C++ to liven up some old C-style libraries.
Enjoy!
..and yet, people are still waiting for your “moderncpp” library with which you teased us for years…
I’m still working on it.
Nice article, Kenny. As a coincidence, my article on the same subject has been published recently in Overload journal (http://accu.org/index.php/journals/2086). The main difference between my approach to RAII and yours is that I used explicit template specializations instead of traits classes.
Very nice!