So I was coding when I run into a Debug assertion. Now I am very interessted why this piece of code does not work:

for(Model::MeshMap::iterator it = obj1->GetMeshes().begin(); it != obj1->GetMeshes().end(); it++)

and this piece of code does:

Model::MeshMap obj1meshes = obj1->GetMeshes();
for(Model::MeshMap::iterator it = obj1meshes.begin(); it != obj1meshes.end(); it++)

In the model class I have this:

typedef std::map<std::string, Mesh*> MeshMap;
有帮助吗?

解决方案

It looks like GetMeshes returns copy and you are trying to compare iterator of one container with iterator of another container. Such comparison is not valid in terms of checked iterators in MSVC. And, thanks to @Mike Seymour, this comparison is not valid according to the C++ standard.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top