Sunday, 16 April 2023

Chapter 26 // Exercise 3 - Principles & Practice Using C++

In this exercise I'm using Visual Studio 2019 and a modified version of the std_lib_facilities header found here.

Chapter 26 // Exercise 3

Repeat exercise 1 with the version of binary_search that takes a comparison criterion. Make a list of new opportunities for errors introduced by that extra argument.

I continued using the code from exercise 2 and created a new testAll function called testAllWithPredicate. This takes in the input stream and a function pointer. I then modified testType to take in function pointer and used some std library comparison functions found in <functional>:

No comments:

Post a Comment