I'm fairly certain that I can safely do:
void funcA(VARIANT &V,_variant_t &vt)
{
vt = V;
}
But what about the other way around:
void funcB(VARIANT &V,_variant_t &vt)
{
V = vt;
}
I've been seeing some REALLY weird behaviour in my app which I put down to COM-related threading issues. But then I got wondering if I was screwing up memory using variants wrongly. In funcB, the VARIANT V is part of a safe-array being prepared for a COM call. With my V=vt line, am I doing a shallow copy which will break things when the same variant gets deallocated twice?
I really like _variant_t and avoiding all the ::VariantXXX methods, is there a neat way to use _variant_t in funcB to automate the copying?