Problem:
--------

In COM you occasionally find functions with signatures like [this](http://msdn.microsoft.com/en-us/library/windows/desktop/ee690135%28v=vs.85%29.aspx):

```
HRESULT STDMETHODCALLTYPE GetColorContexts( 
        UINT cCount,
        IWICColorContext **ppIColorContexts,
        UINT *pcActualCount)

```

The problem this presents for me is that `ppIColorContexts` must be an [initialized](http://msdn.microsoft.com/en-us/library/windows/desktop/ee690299%28v=vs.85%29.aspx) array of `IWICColorContext *`. I have tried referencing the first element of a `Vector` of `ATL::CComPtr<IWICColorContext>` with no such luck it won't trigger the `()` operator so it complains about a type mismatch.

Attempted solutions:
--------------------

* `vector<ATL::CComPtr<IWICColorContext>>` failed due to type mismatch, as noted in the comments this has other issues as `CComPtr` overloads `operator &` which breaks STL containers. It seems that this was [fixed in C++11](http://blogs.msdn.com/b/vcblog/archive/2011/09/12/10209291.aspx) and was included in the STL in VC2010
* `BOOST_SCOPE_EXIT_ALL` works but still means I'm manually managing the lifetime of the COM objects which is something I'd like to get away from.

Unattempted solutions:
----------------------

* Custom data structure - this is likely what I'll have to do if there is not a more elegant solution, but at least it would allow me to take advantage of destruction semantics properly.
* Attach a `CComPtr` after this call - I dislike this solution because it leaves me with a period of execution where the resource may not get released if something goes wrong.
* `std::unique_ptr<IWICColorContext[]>` with a custom deleter - I have yet to fully explore this possibility but it would ensure that the COM objects would always get released.