I am working on a small graphics engine project, and I want it to switch to the platform (someday). I was developing the latest version of MinGW and C ++ 0x. For event listeners, I use lambda functions stored in std :: map, which will be called when a certain event occurs. It works very smoothly with MinGW, but the other day, when I tried it in Visual Studio (latest version), it failed.
I checked the lambda type, and even if I defined two lambdas that were the same, they would get different types (anonymous namespace :: and anonymous namespace: :)).
For example, I have this std :: map for storing scroll listeners
std::map<int,void (*)(int p)> scrollListenerFunctions;
And then I can add a listener by simply doing:
addScrollListener([](int p){});
As I said, this works fine in MinGW, but doesn’t work in Visual Studio, is there a way to make it work in both cases, and is it even possible to store lambdas in VS atm?
If you need / need to see more code, you can find it here http://code.google.com/p/aotk/source/browse/ lambda maps are located in window.h / window.cpp
source
share