Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualBregma

Posted 06 November 2012 - 10:53 AM

ok, i think i need to learn some lambda expression.

Yes, assuming you have a compiler that supports the current C++ standard.

but Is this the only solution to use "lumbda"?

No. You can hand-craft a functor class (if your compiler does not support lambdas) or use std::bind (or boost::bind if your compiler does not support the current C++ standard).

And what the performance about the lumbda?

Generally as good as you can get. The compiler will effectively transform the expression into an inline function.

Can i use huge amount of lumbda expressions in my code?

Yes you can. Don't. You can use them frequently, but if the expression is more than a few (1 to 7, say) lines then from a readability standpoint you would benefit from writing a separate function and using std::bind if currying arguments is required. Short lambda expressions increase code readability, longer ones decrease it.

#2Bregma

Posted 06 November 2012 - 10:53 AM

ok, i think i need to learn some lambda expression.

Yes, assuming you have a compiler that supports the current C++ standard.

but Is this the only solution to use "lumbda"?

No. You can hand-craft a functor class (if your compiler does not support lambdas) or use std::bind (or boost::bind if your compiler does not support the current C++ standard).

And what the performance about the lumbda?

Generally as good as you can get. The compiler will effectively transform the expression into an inline function.

Can i use huge amount of lumbda expressions in my code?

Yes you can. Don't. You can use them frequently, but if the expression is more than a few (1 to 7, say) lines then from a readability standpoint you would benefit from writing a separate function and using std::bind if currying arguments is required. Short lambda expressions increase code readability, longer ones decrease it.

#1Bregma

Posted 06 November 2012 - 10:52 AM

ok, i think i need to learn some lambda expression.

Yes, assuming you have a compiler that supports the current C++ standard.

but Is this the only solution to use "lumbda"?

No. You can hand-craft a functor class (if your compiler does not support lambdas).

And what the performance about the lumbda?

Generally as good as you can get. The compiler will effectively transform the expression into an inline function.

Can i use huge amount of lumbda expressions in my code?

Yes you can. Don't. You can use them frequently, but if the expression is more than a few (1 to 7, say) lines then from a readability standpoint you would benefit from writing a separate function and using std::bind if currying arguments is required. Short lambda expressions increase code readability, longer ones decrease it.

PARTNERS