Homework 3: Function Objects and Generic Algorithms

Due 03/27/05

Educational Objectives: Experience with creating function objects and using them in generic algorithms.

Operational Objectives: Create a predicate class fsu::CaseInsensitiveLessThan that can be used in generic sort routines to alphabetize strings without regard to whether the letters in the strings are upper or lower case, and test the class by passing a CaseInsensitiveLessThan object as a parameter to the generic algorithm fsu::g_simple_sort() to sort a list of fsu::String objects.

Deliverables: One file myPredicate.h.

Procedural Requirements

  1. Turn in one file myPredicate.h containing both the declaration and implementation of your predicate class using the hw3submit.sh submit script.
  2. Warning: Submit scripts do not work on the program and linprog servers. Use shell.cs.fsu.edu to submit this assignment. If you do not receive the second confirmation with the contents of your project, there has been a malfunction.

Technical Requirements and Specifications

  1. CaseInsensitiveLessThan should be a predicate class such that the statement

    fsu::g_simple_sort (X.Begin(), X.End(), cilt);
    

    results in a case insensitive sorting of the container X, where X may be of any of the three types

    fsu::TVector<fsu::String> X;
    fsu::TList<fsu::String> X;
    fsu::TDeque<fsu::String> X;
    

    and where cilt is an object of type CaseInsensitiveLessThan.

  2. Test your class under all of the circumstances asserted in step 1, that is for vectors, lists, and deques of string objects.
  3. Your submission will be assessed using a proprietary test harness. This harness will use your submission as a function object. It is your responsibility to ensure correct behavior of your function class.

Hints