![]() ![]() You can indeed use global and static variables from lambdas without capturing them but you need to be a bit careful with that. Update: After reading more carefully that is actually not what you are saying. What you are essentially saying is that you want to capture a lambda from a capturless lambda, but that doesn't make sense, because if it captures it's no longer capturless. A pointer to a member function is useless unless you have an object to call it on. The situation is similar to that of pointers to member functions. If you were able to convert a capturing lambda into a function pointer you would lose everything that had been captured. ![]() the lambda body) does not use anything within the object (because it's empty). This should be fine because the code that the function pointer refers to (i.e. A lambda that does not capture anything can be implicitly converted to a function pointer. You can think of a lambda as creating an object that contains a function pointer plus everything that has been captured. So the idea is to wrap capturing lambda in capturless one :)Ī function pointer is just a pointer to some piece of code. #include #include #include using FrameCallback = int(*)( int, int)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |