what exactly are driver functions?
c++
Solution
Inside your two `if` blocks, how similar is the code that operates on `allStudents` and `fail` regardless of whether they are `list` or `vector`? If you've done the assignment correctly, there is probably little or no difference. Now if you take that code out and remove references to `list` and `vector` and instead operate on `mytype` where you build either with `typedef vector<Student_info> mytype` or `typedef list<Student_info> mytype` you will have what they were calling a "driver function". It's not a formal name you're going to find internet references to. They were just describing the code that drives the `list` and `vector` operations to get the answer.
Problem
I'm working through "Accelerated C++". I have a question about problem 5-3. It asks: ``` 5-3. By using a typedef, we can write one version of the program that implements either a vector-based solution or a list-based one. Write and test this version of the program.' ``` The next question asks: ``` 5-4. Look again at the driver functions you wrote in the previous exercise. Note that it is possible to write a driver that differs only in the declaration of the type for the data structure that holds the input file. If your vector and list test drivers differ in any other way, rewrite them so that they differ only in this declaration. ``` What exactly are driver functions? I've solved 5-3 by creating if statements as well as overloaded functions to deal with different datatypes like so: ``` cout << "Please enter 1 if you would like to use vectors, or 2 if you would like to use lists: "<< endl; int choose; cin >> choose; //CHOOSING TO USE VECTORS if (choose == 1){....vector<Student_info> allStudents; vector<Student_info> fail;.......} //CHOOSING TO USE LISTS else if (choose==2) {....list<Student_info> allStudents; list<Student_info> fail;....} //INVALID CHOICE else {...invalid number, try again...} ``` I did not create any extra functions besides the overloaded ones to deal with different data types. Are those driver functions? If not, I must be doing the problem wrong. Could someone shed some light? :>