问题
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