Learn how relational functors provide relational comparisons for transform and other functions that require operator functions.
- [Instructor] The relational functors…are standard template functors…defined in the functional header of the STL,…and here's the functional header there.…I have a working copy of relational.cpp…from chapter five of the exercise files.…And I just wanted to show you this really quick,…my normal display V for displaying vectors.…I have modified it a little bit,…because we're going to be…talking about relational operators.…If the type ID of the vector is bool,…then I want to display true and false,…rather than simply the value.…
And so here's a nice little use of type ID…to check the type of a template type…inside of a template and do something different…if it's one type then another.…This works really, really well…and it's not that uncommon.…So here we have three vectors.…Two of them are of type long…and they have these integer values in them,…and this one is of type bool,…which will be for our result.…Here's our functor and this is from the functional header…in the STL.…
And we're using it as the transformation here…
- Template fundamentals
- STL containers
- Accessing iterators
- Output, forward, and bidirectional iterators
- The transform function
- Transforming strings and types
- Arithmetic, relational, and logical functions
- STL algorithms
Skill Level Intermediate
2. STL Containers
3. STL Iterators
5. STL Functions
6. STL Algorithm
- 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.