1>f:\path\d3d11hook\MyConsoleWindow.h(304) : error C2440 : 'initializing' : cannot convert from 'MyConsoleWindow::<lambda_ea6abeb6dbe475b4705e8a99f99a9a79>' to 'int (__cdecl *)(ImGuiTextEditCallbackData *)'
1>f:\path\MyConsoleWindow.h(304) : note: No user - defined - conversion operator available that can perform this conversion, or the operator cannot be called
1>f:\pathMyConsoleWindow.h(304) : error C2439 : 'MyConsoleWindow::test' : member could not be initialized
1>f:\path\MyConsoleWindow.h(300) : note: see declaration of 'MyConsoleWindow::test'
I have no idea how to solve this issue, especially since i just picked up Lambda`s.
Thanks for any help.
classes can have static data elements or static functions, either or both.
are you asking for syntax example of this? It works fine. If you make a static data element, like bool show, if you change it in one instance of the class, you change it for all ... its shared effectively.
A lambda can only be converted to the corresponding function-pointer type if its capture-list is empty. Remember that the type of a lambda expression is exactly an (anonymous) class: your attempt simply moves the problem elsewhere (into the resultant ClosureType).
There is a void* parameter available for this purpose. Pass the callback a handle to the appropriate member function, or the data you need.