Variadic functions are like the C-language printf; they can take a variety of different parameters. In this video, learn how to create your own variadic functions.
- [Instructor] C plus plus variadic functions…are a C holdover.…They have always been a bit problematic to use,…since there's no checking of the past argument types.…Variadic template functions use generic templates…to make variadic argument passing cleaner,…and it is still able to work…with a heterogeneous set of arguments.…Let's take a look at an example.…In this bit of code, we have…to find a variadic template function name rcatenate.…It takes the variable number of standard strings,…notice that I'm saying standard strings,…not C strings, and reverse concatenates them…with spaces in between the words.…
By the way, this is just a bit of sample code.…It is definitely not ready for prime time.…The args dot dot dot args is the parameter pack.…The way it works is pretty cool.…It essentially means the rest of the arguments.…So, in our example, when we call with three arguments,…first, the first one is assigned a first,…and the remaining two are assigned to args.…Then when we do our recursive call,…the second argument is assigned a first,…
- Major new C++ features
- Turning on modern C++
- Letting the compiler help
- Using the new features correctly
- Using auto type deduction
- Using lambdas
- Range-based for loops
- How C++ and the Standard Template Library name things
- Making the best of the filesystem library
- Managing objects
Skill Level Beginner
1. What Is Modern C++?
2. Tools That Improve Your Code
3. Using the New Features Correctly
4. Don't Reinvent the Wheel
5. Managing Objects
- 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.