-
August 30th, 2012, 06:31 AM
#1
Got 3 sisters fighting in mind: (function pointer, function object, lambda function)
Hi Experts,
I got 3 sister concepts playing and colliding in my mind. I know each can be passed to another function. All of them seem to me like alternatives with subtle differences.
1. function pointer: a pointer to a function
2. function object: instance of a class that has overloaded the () operator; capable of acting as a function;
3. lambda function: an anonymous function (newly introduced in C++11) that may be defined on the spot and that exists only during the lifetime of the statement of which it is a part
Because of the subtilities, I wonder which of the 3 choices would be the most appropriate in a given scenario. So, experts out there, kindly shed some light (on some selection criteria?) so that I could decide and use them in different scenarios.
BR,
softwarelover
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|