Skip to content

Latest commit

 

History

History

README.md

CPP3 - C++ STL & operator overloading

Video (20:21): - Example of operator overloading

Note that while we only overload the +, <, >, and << operators in this video, those are not the only operators you can overload. See the C++ information page for a list of operators you can overload.

Video (6:00): Demonstrates constructors and destructors get called and why destructors need to be declared virtual

C++ Vectors In general, you should always prefer using the STL classes when you can. Use vectors - especially instead of creating arrays with new.

Video (12:20): Vectors of user-defined objects

In this video I show an example of using a vector to store objects of a custom class. You should review the other vector videos first so that you understand how vectors work.

Examples of looping through a vector with iterators: a forward loop using begin()/end(), a backward loop using the reverse iterators rbegin()/rend(), and a comparison with the range-for loop.

Compares three ways of passing an argument to a function - by value, by pointer, and by reference - and shows which ones allow the function to change the caller's variable.

Video (8:43): C++ Maps

Video (5:22) : Another example of using C++ Maps, this time with a custom class as the key value

NO VIDEO : Example of generating random integers

Video (13:45): Methods from the C++ algorithms library

Note that the examples of any_of, any_of, none_of all use lambdas which we haven't covered yet. For now, just keep in mind that the lambda function is contained between the braces, so you can update that part to have it do what you want.

Video(10:00) Example of reading a file & parsing a string in C++. This program is equivalent to readfile.c.

The file numbers.txt is a sample input file you can use with this program.