What does this code do?
COM
2
Posts
2
Posters
0
Views
1
Watching
-
Look near the bottom of the code snippet. I'm not sure what the code is doing, can someone explain.
template class _com_ptr_t {
public:
typedef _IIID ThisIIID;
typedef typename _IIID::Interface Interface;
static const IID& GetIID() throw()
{
return ThisIIID::GetIID();
}template \_com\_ptr\_t(const \_com\_ptr\_t<\_OtherIID>& p) throw(\_com\_error) : m\_pInterface(NULL) { HRESULT hr = \_QueryInterface(p); if (FAILED(hr) && (hr != E\_NOINTERFACE)) { \_com\_issue\_error(hr); } } template \_com\_ptr\_t(\_InterfaceType\* p) throw(\_com\_error) : m\_pInterface(NULL) { HRESULT hr = \_QueryInterface(p); if (FAILED(hr) && (hr != E\_NOINTERFACE)) { \_com\_issue\_error(hr); } } template<> \_com\_ptr\_t(LPSTR str) throw(\_com\_error) { new(this) \_com\_ptr\_t(static\_cast (str), NULL); <<<<<<-- WHAT IS THIS LINE DOING? } ...
}
-
Look near the bottom of the code snippet. I'm not sure what the code is doing, can someone explain.
template class _com_ptr_t {
public:
typedef _IIID ThisIIID;
typedef typename _IIID::Interface Interface;
static const IID& GetIID() throw()
{
return ThisIIID::GetIID();
}template \_com\_ptr\_t(const \_com\_ptr\_t<\_OtherIID>& p) throw(\_com\_error) : m\_pInterface(NULL) { HRESULT hr = \_QueryInterface(p); if (FAILED(hr) && (hr != E\_NOINTERFACE)) { \_com\_issue\_error(hr); } } template \_com\_ptr\_t(\_InterfaceType\* p) throw(\_com\_error) : m\_pInterface(NULL) { HRESULT hr = \_QueryInterface(p); if (FAILED(hr) && (hr != E\_NOINTERFACE)) { \_com\_issue\_error(hr); } } template<> \_com\_ptr\_t(LPSTR str) throw(\_com\_error) { new(this) \_com\_ptr\_t(static\_cast (str), NULL); <<<<<<-- WHAT IS THIS LINE DOING? } ...
}