KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying the lambda-expressions from the new standard, and still don't understand them quite well. Let's say I have a lambda somewhere in my code, e.g. in my main: int main( int argc, char * argv[]) { //some code [](int x, int y)->float { return static_cast<float>(x) / static_cast<float>(y); }; //some more code here //<---now I want to use my lambda-expression here } Well obviously I might need to use it multiple times, so the answer "just define it right there" doesn't work :P So, how do I call this lambda expression later in the code? Do I have to make a function pointer to it and use that pointer? Or is there a better/easier way?
Tags (comma-separated)
Save Edits
Cancel