Although the em(construction) of class templates is the topic of chapter
ref(TEMPCLASS), we've already extensively em(used) class templates before. For
example, abstract containers (cf. chapter ref(CONTAINERS)) are defined as
class templates.  Class templates can, like
 hi(ordinary class)hi(class: ordinary)
    ordinary classes, participate in the construction of class hierarchies.

    In section ref(DERIVEDTEMPCLASS) it is shown how a i(class template) can
be derived from another class template.

    As class template derivation remains to be covered, the following
discussion is necessarily somewhat premature. The reader may of course skip
briefly to section ref(DERIVEDTEMPCLASS) returning back to this section
thereafter.

    In this section it should be assumed, for the sake of argument, that a
class template tt(Vector) has somehow been derived from a tt(std::vector).
Furthermore, assume that the following function template has been
constructed to sort a vector using some function object tt(obj):
        verb(
    template <typename Type, typename Object>
    void sortVector(std::vector<Type> vect, Object const &obj)
    {
        sort(vect.begin(), vect.end(), obj);
    }
        )
    To sort tt(std::vector<string>) objects case-insensitively, a tt(class
Caseless) could be constructed as follows:
        verb(
    class CaseLess
    {
        public:
            bool operator()(std::string const &before,
                            std::string const &after) const
            {
                return strcasecmp(before.c_str(), after.c_str()) < 0;
            }
    };
        )
    Now various vectors may be sorted using tt(sortVector()):
        verb(
    int main()
    {
        std::vector<string> vs;
        std::vector<int> vi;

        sortVector(vs, CaseLess());
        sortVector(vi, less<int>());
    }
        )
    Applying the transformation
        hi(transformation to a base class)
        hi(class template: transformation to a base class)
    em(transformation to a base class instantiated from a class template), the
function template tt(sortVector) may now also be used to sort tt(Vector)
objects. For example:
        verb(
    int main()
    {
        Vector<string> vs;      // `Vector' instead of `std::vector'
        Vector<int> vi;

        sortVector(vs, CaseLess());
        sortVector(vi, less<int>());
    }
        )
    In this example, tt(Vector)s were passed as argument to
tt(sortVector). Applying the transformation to a base class instantiated from
a class template, the compiler considers tt(Vector) to be a tt(std::vector)
enabling it to deduce the template's type parameter. A tt(std::string) for the
tt(Vector vs), an tt(int) for tt(Vector vi).
