Troy shows us why lambdas are his favorite new thing in C++. He explains how lambda functions allow us to convert programming statements into far more useful expressions in this video.
- [Instructor] Lambdas were introduced to the language…with C++11, they are unnamed function objects…which can create a closure over the invoking scope.…Let's write some code to learn more about lambdas.…We already have this file set up, we have some code…down here inside of our main function,…and this is just going to render the results…once we're ready for it.…We have our include and using already set up,…and we're going to create an auto variable called addCurry,…and we're going to set this equal to auto a,…and this is going to be our lambda.…
And then it is going to return,…and right here in our capture list,…we're going to put the a,…and this means that we want to be able to access a…from our inner lambda, and then we're going to have…a parameter list, and that's going to be b.…Then b is also going to return,…and what it's going to return is another lambda,…and so inside of the capture list for the b,…we're going to put a and b, 'cause we're want them both.…
Then we're going to have another auto,…and that's going to be c,…
- Unit testing and functional programming
- Function and Lambda functions
- C++ templates
- Working with the Standard Template Library and Boost.Hana
- Functional reactive programming
Skill Level Intermediate
2. Functional Programming in Modern C++
3. Template Metaprogramming
4. Functional Reactive Programming
RxCpp library5m 21s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.