The compiler (VC8) error is:
error C2680: 'std::_Tree<_Traits>::iterator' : invalid target type for dynamic_cast
the source code to simulate the error :
[EDIT]source fixed now
#include <map>
#include <string>
struct tag_data
{
int in;
int on;
std::string sn;
};
class myclass
{
private:
typedef std::map<std::string, tag_data> TypeData;
TypeData MapStorage;
typedef std::map<unsigned long, TypeData::iterator > TypeToThreadIterMapStorage;
TypeToThreadIterMapStorage ThreadIterMapStorage;
public:
bool find( std::string& k)
{
TypeData::const_iterator theData ;
theData = MapStorage.find(k);
//ThreadIterMapStorage [ 0 ] = MapStorage.begin();// this is ok
ThreadIterMapStorage [ 1 ] = dynamic_cast<TypeData::iterator>(theData); // the error occurs here
return theData != MapStorage.end();
}
virtual ~myclass(){}
};
int _tmain(int argc, _TCHAR* argv[])
{
myclass mc;
return 0;
}