question mark in visual studio debugger

2019-08-29 03:28发布

I'm using VS 2010 to program in C++. In debug mode I usually am able to see the content every object/container that I am using, even the ones that comes from the STL. Except that for the following "Entity_set_z_ordered" set, I am unable to see the content of my container, in debug mode it just shows a "?"

struct z_orderer {
        bool operator() ( const Entity* lhs, const Entity* rhs) const{
            return (lhs->getPosition().y < rhs->getPosition().y || ( (lhs->getPosition().y == rhs->getPosition().y) && lhs->getPosition().x < rhs->getPosition().x));
        }
    };
std::set<Entity*, z_orderer> Entity_set_z_ordered;

Any idea of where this is coming from or how I could debug this? I haven't changed any of the default Debug setting

thanks

edit : I solved it, the problem was that struct z_orderer was defined inside my main function and not outside of it. I'm not sure if this would have created problems during runtime, but at least I can debug it now!

1条回答
你好瞎i
2楼-- · 2019-08-29 03:43

For anyone else that stumbles across this... this happened to me when I had a getter property in a class model pointing to itself. It was a copy paste error, notice the property name below is ShouldNotProcess, and in the getter it's returning itself. The return was supposed to be: return !this.ShouldProcess;

public bool ShouldNotProcess
{
    get { return !this.ShouldNotProcess; }
}
查看更多
登录 后发表回答