cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
lambda functions
lambda functions
Jan 7, 2013 at 1:55pm UTC
jaded7
(104)
Hi,
I've been trying to pick up lambda functions but I wasnt clear on one detail- is there a rule of thumb when to use closure or a function parameter, when both can have the same effect?
Jan 7, 2013 at 2:23pm UTC
vlad from moscow
(6539)
In general it is preferable to have local variables instead of class data members where it is possible.
Jan 7, 2013 at 2:41pm UTC
jaded7
(104)
So, by default I should pass variables via function arguments, not closure?
Then, in what circumstances should specific closure be used?
Jan 7, 2013 at 2:43pm UTC
vlad from moscow
(6539)
When 1) you can not pass a variable as an argument 2) you need a reference to a variable.
Jan 7, 2013 at 3:04pm UTC
jaded7
(104)
Thanks for the tips.
Jan 7, 2013 at 3:10pm UTC
JLBorges
(13770)
> So, by default I should pass variables via function arguments, not closure?
> Then, in what circumstances should specific closure be used?
See:
http://www.cplusplus.com/forum/general/63061/#msg342081
Topic archived. No new replies allowed.