WTL initialization, Com and C++ namespaces

 

[May 11th, 2006]

Recently I was thinking what should be my first code contribution to the WTL project? And here it is: a seemingly simple COM initialization mechanism.

Why “seemingly simple”? Because it is done with the healthy dose of using the C++ anonymous namespace, in order to make it (completely) transparent, but still a (very) effective solution.

I do particularly like these ‘invisible’ C++ constructs actually doing a useful job.  Enough of theory, here is the practice (aka “the code”) :

 

This is also available in the GIST form.