I have an ATL COM component method which takes a BSTR as an in parameter. I need to add each call to this method in an array. I can't use a SAFEARRAY as that is fixed size so I was thinking that std::vector would be the easiest choice. Of course I will need to call SysAllocString for each addition to the vector. This means that SysFreeString needs to be called for each entry before the vector is destroyed.
I was looking for an easier/cleaner solution and thought of declaring the vector as vector<_bstr_t> which would include automatic cleanup. However, something in the back of my mind is raising the alarm at holding what is effectively a smart pointer in a standard container. Are my worries justified or can I safely do this? If not are there any other nicer solutions?