Due: Friday, November 3, 2023
Reading: Finish Me!
The attached file, Templates.zip, contains several example function templates. For this assignment, you are interested only in issorted.hpp and its demonstration program issorted_demo.cpp.
Complete the function template named is_sorted that takes two forward iterators delimiting a sequence, and that returns true if and only if the sequence is in sorted order. Your template can use operator < on the sequence elements to define the desired ordering.
Complete the second function template also named is_sorted that takes two forward iterators and a comparison object (the type of which is given by a template type parameter). It should return true if and only if the sequence is in sorted order according to the comparison object.
Modify the demonstration program to include a comparison object that will cause the sort to go in descending order. Use the object to resort the vector in the program and then use is_sorted to verify that the sorting worked. Do not replace the code currently in the demonstration program, add your new code to the end.
Submit your two modified files in a zip archive to Canvas.
Last Revised: 2023-10-25
© Copyright 2023 by Peter Chapin
<peter.chapin@vermontstate.edu>