std::map of CComBSTR corruption
Hi everybody,
I'm using an std::map<CAdapt<CComBSTR>,int> and i'm having some
trouble.
This little chunk can explain what I'm doing:
typedef std::map<CAdapt<CComBSTR>,int> m_t;
m_t m;
m.insert(m_t::value_type(CComBSTR(L"foo"), 0));
// some other insert operations
// some other code that access the map in a const way
// If I look here at m with debugger I can see all the elements
correctly sorted
for (m_t::const_iterator it=m.begin();it!=m.end();++it)
{
// If I look here at m with debugger I can see all the elements
correctly sorted
// some other code that access the map in a const way
}
here (sometimes) the iteration through the map never reaches the end.
Before reaching the end the iteration restarts from the beginning. If
I use std::wstring the trouble never happens. If I switch off compiler
optimization I cannot reproduce the problem.
Do you have any idea on how I can see some strange behaviour. Do you
think it can be related with CComBSTR (I cannot guess how it could be,
but perhaps I'm missing something)?
Thanks in advance, Daniele.