Why do I have to specify the deleter type?
A great question. I wanted the compiler to deduce the deleter type automatically. Then the programmer does not need to specify it and can’t get it wrong. Sadly, I think the Windows data types are too badly broken for it to be possible. (Or it might be that my CPP is not good enough. Call or email if you can make it work.) If you compile your Windows program with #define STRICT – it’s the default now so it’s hard to avoid – then Windows types such as HANDLE, HINSTANCE etc, all become different types in the eyes of the compiler. This means that the compiler can trap you using (say) ::CloseHandle() to dispose of an HINSTANCE. Sadly Microsoft has not continued this all the way through. Even though HCRYPTPROV, HCRYPTHASH and HCRYPTKEY have to be disposed of differently, they are all typedef’d to the same underlying type. Therefore the compiler cannot tell them apart. Rather than have one rule for one set of types and a bunch of non-obvious exceptions, I thought it safer to make it compulsor