C++ has included some functional programming features for quite sometime. Troy explores copy_if in this video.
- [Instructor] So let's go ahead and create our copy_if.…So first thing we want to do is get a little bit of space.…We're going to create another vector.…It's going to be of int,…and we'll call this filteredCollection.…We're going to use back_inserter on it,…so we don't need to initialize it with any data,…and we're going to have our copy_if,…and…it takes an…outCollection.begin,…which is our…begin iterator.…
Then we're going to have outCollection.end.…There's our end iterator,…and we'll go ahead and put this on the next line.…We'll scroll up a little bit,…just give ourselves a little bit more room.…Then we're going to have a back_inserter,…back underscore inserter,…and this is going to take our filteredCollection,…and finally, we'll have our lambda,…and our lambda is going to be…open, close square brackets, parentheses,…and we have an int,…reference to a value,…and then open and close curly braces,…and inside of here, we will have a return,…and it will do a value,…modulus two,…not equal to zero,…and this is going to say if it is an odd value,…
- 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.