List
is a sub class of the MFC class CList
. It uses the functionality of CList
with some improvements. The default constructor does nothing but call the matching constructor of the base class. CList
has no copy constructor, so the copy constructor of List
adds the given list to its own. Nor does CList
have a method Remove
which takes a value and removes it from the list if it finds it.
template<typename T> class List : public CList<T> { public: List(); List(const List<T>& list); void Remove(T value); List<T> FilterIf(BOOL Predicate(T value)) const; int CountIf(BOOL Predicate(T value)) const; };
FilterIf
takes a function Predicate
that returns a logical value as parameter, applies it to every element in the list, and returns a list containing every element that satisfies Predicate
(every element in the list for which Predicate
returns true). CountIf
does the same thing, but returns just the number of satisfied elements...