CComPtr的向量是否仍然需要CAdapt? [英] Do vectors of CComPtr still need CAdapt?
问题描述
STL具有 std :: addressof
,即使它重载运算符&
。在 std :: vectors中存储
。 CComPtrs
时需要使用 ATL :: CAdapt
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
.
无论如何,我想知道,使用C ++ 11,应该 std :: vector
包含 CComPtr
,而不需要 CAdapt
?
Anyway, I'm wondering, with C++11, should std::vector
be able to cope with containing CComPtr
's directly without CAdapt
being necessary?
更具体地说,我使用的是VS 2013.是否支持向量
没有 CAdapt
?
More specifically, I'm using VS 2013. Would that support vector
without CAdapt
?
推荐答案
引自 MSDN :
这是C ++标准库容器
在支持C ++ 11标准之前最常用的,但是C ++ 11标准库
容器自动使用重载了
运算符&()的类型。
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&().
这看起来像你不需要 CAdapt
,因为Visual Studio 2013带有C ++ 11 STL。
This reads like you don't need CAdapt
anymore because Visual Studio 2013 comes with a C++11 STL.
这篇关于CComPtr的向量是否仍然需要CAdapt?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!