#include <windows.h>
#include <atlbase.h>
#include <list>
int
_tmain(int argc, _TCHAR* argv[]){
std::list<CComPtr<IUnknown> > l;
l.insert(l.begin(), CComPtr<IUnknown>());
return 0;
}
Should line #1163 of #include <list> be changed from:
this->_Alval.construct(&_Myval(_Pnode), _Val);
to something like:
this->_Alval.construct(reinterpret_cast<_Ty*>(&reinterpret_cast<unsigned char&>(_Myval(_Pnode))), _Val); As it is currently coded, any class that implements operator&() has a good chance of failing to compile and thus be impossible to serve as an element of a list (or any other STL container that utilizes a list):
For example, the following will also fail:
class A
{
public:
A() {}
int* operator&() const { return p; }
private:
int* p;
};
void f()
{
std::list<A> l;
A a;
l.insert(l.begin(), a);
}

Undesirable STL Compile Breaking Change in RC
rankind
The CopyConstructible requirements (section 20.1.3 of the Standard) explicitly states that for objects stored in the standard containers, operator&() must return the address of the object. That pretty much prohibits overloading it.
jlang64
You are both correct and I thank you both for sharing your knowledge. I should have researched it more before posting, but I was afraid that a bug that I would not be able to workaround was going to be released.
Thanks
Kevin.Ji
Read the msdn for it.
http://msdn.microsoft.com/library/default.asp url=/library/en-us/vclib/html/vcrefcadapt.asp
http://msdn.microsoft.com/library/default.asp url=/library/en-us/vcsample98/html/vcrefatlcollectionssample.asp