You are not passing an address of CComBSTR
, but an address of its m_str
member. CComBSTR
happens to provide, among other things, an operator&()
that returns &m_str
.
operator TYPE () and taking the address of an object
-
02-06-2022 - |
سؤال
The ATL class CComBSTR has a BSTR
member m_str
and an operator BSTR ()
which returns m_str
.
Now, if a function takes a BSTR *
as argument, is it ok to pass the address of a CComBSTR
?
CComBSTR path;
// signature is IzFileFinder::GetDir(CY index, LPBSTR path)
fileFinder->GetDir(INT64toCURRENCY(i), &path);
The compiler doesn't complain, but if it really is ok, why does it work?
المحلول
لا تنتمي إلى StackOverflow