Do vectors of CComPtr still need CAdapt?

孤者浪人 提交于 2019-12-11 00:55:10

问题


STL has std::addressof which gets the true address of an object even if it overloads operator &. ATL::CAdapt was required to workaround this problem when storing CComPtrs in std::vectors.

Anyway, I'm wondering, with C++11, should std::vector be able to cope with containing CComPtr's directly without CAdapt being necessary?

More specifically, I'm using VS 2013. Would that support vector without CAdapt?


回答1:


Quoted from MSDN:

This was most commonly necessary for C++ Standard Library containers prior to support for the C++11 Standard, but C++11 Standard Library containers automatically work with types that have overloaded operator&().

This reads like you don't need CAdapt anymore because Visual Studio 2013 comes with a C++11 STL.



来源:https://stackoverflow.com/questions/24285016/do-vectors-of-ccomptr-still-need-cadapt

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!