Herrick C++ Library
This is a C++ library of classes I've built and
found useful. I am creating it by extracting useful classes from programs I have
written. It is painstaking to extract the source and polish them up. Currently
the library is very small, but I have a lot to add. Some of the source makes
heavy use of templates, so you need a pretty modern compiler to get full use of the
library. This library currently contains:
This class template adds an STL vector interface to an array. The
template may be instantiated to use either constructors or initializer
lists. This class is useful for times when the maximum size of the
container is known and dynamic allocation is undesirable.
This singleton class provides a filterable debugging log that may be
dynamically enabled or disabled. The log messages may be routed to
various destinations, such as a file.
This class defines a non-deterministic finite automaton, which can be
matched against a given set of input. The NFA can be converted to a
DFA (deterministic finite automaton). The library also defines
counting_nfa, which adds counted cycles to an nfa. Cycles may be
defined that loop for exactly N times, at least N times, at most N times, or
between N and M times, inclusive.
This class mimics as closely as possible the set type of the Pascal
Language. The class works with any integral type, but is meant to be
partnered with an enumeration type to be used as the set's element type.
The objects of the class are very compact, storing the set members in one
bit per member. A member class
template is provided to generate set constants at compile time.
ranged_type is a class template used to define range and overflow checked
integer types. If an attempt is made to construct or assign an out-of-range
value to a ranged_type, or if an arithmetic operation overflows, a member
function is called. The default behavior is to throw an exception.
ranged_type does some static analysis using templates to remove checks that
it determines are unnecessary. This reduces that overhead occurred in doing
the range and overflow checks.
regex is a regular expression class. It supports a large number
of features common to most regular expression implementations.
This singleton class provides a monotonically increasing time source, using
the best (known) clock available. Functions are provided to convert
between clock ticks and various units of time. A "sleep" function is
These template classes test, modify, or glean information from types.
This template class provides a type-safe union. It may contain any
type, including arrays and references. Classes with constructors may
also be used, unlike actual unions. Accesses are checked to ensure
that the type of object being accessed is the same as the actual one that is
currently stored in the record. Unchecked access may also be done.
Any comments or questions, please email me.
Return to Main Software Page