© 2005,2009,2014 John Abbott
GNU Free Documentation License, Version 1.2

CoCoALib Documentation Index


User Documentation

The file offers a few handy functions on standard C++ containers (principally vector and list).


Maintainer documentation

The output functions are specifically only for vector and list; I cannot make it more general without ambiguities arising.

The implementations of the printing functions could hardly be simpler. The only "clever" part is the fn OutputRange which actually does the work.

Implemented as template code in the header file. The implementation is slightly indirect to allow use of std::for_each (also so that would work with lists/vectors/etc)

Bugs, Shortcomings, and other ideas

OutputRange is publicly visible, but is not intended for public use.

Impl of sum and product is a bit too complicated. Need a template expert to clean it.

Perhaps add also a LexCmp3 that takes complete containers? Currently it is "STL compatible" (which I think is usually awkward). It would make the calls in symbol.C neater!

Activate the commented out template fn cmp? The type int seemed the most natural choice for the return value of this three-way comparison functions (though signed char would be big enough). The implementation assumes that operator< is defined; this decision was inspired by assumptions made by various STL functions. The types of the arguments may be different as this is probably be more convenient for the user. Obviously the generic definition given here can be overridden by more efficient specific definitions for certain argument types.

Main changes