+ Reply to Thread
Results 1 to 2 of 2

Thread: How can I pass one or more arguments in lambda function?

  1. #1

    How can I pass one or more arguments in lambda function?

    I am newbie to lambdas. I heard that they are very useful. I want to create a lambda which takes argument. How can I do this? Please let me know.

  2. #2
    Junior Member
    Join Date
    Feb 2012
    Posts
    48
    See the below code example:

    Code:
    int PassingArgumentsInLambda()
    {
    	int minimum = [] (int nValue1, int nValue2) -> int
    					{
    						if(nValue1 < nValue2)
    						{
    							return nValue1 ;
    						}
    
    						return nValue2 ;
    					} (10, 27) ;
    
    	return minimum ;
    }
    You should see the bold letters that passes argument in lambda.

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts