This mini-package provides a simple class, Block, that can serve as a fixed-size container (in the STL sense) and that can also serve as a replacement for a native C++ array.
This package may be obtained from the following sources:
fsgi02.fnal.gov), in directories rooted at /afs/fnal.gov/files/reports/working-groups/fpcltf/ZMtools.
Walter Brown, Module Coordinator
Fermilab Physics Class Library Task Force
Comments, questions about getting started, feature needs, and bug/annoyance reports may be sent to email@example.com or firstname.lastname@example.org.
This module provides a fixed-size C++ container class that fully supports all operations needed to cooperate smoothly with the standard C++ library algorithms, yet supplies all the operations and benefits of a fixed-size native C++ array.
To use the Block facilities, a user simply includes the header file:
Subsequently, the user may instantiate and employ one or more Blocks, as in the following simple example:
Block< int, 20 > a; ... a = 16; ... std::cout << a.size();
A test program that validates the behavior of the Block<> template is available in the program zmtBlockTest.cc, furnished as part of this module.
The sole header file needed by the user is ZMtools/Block.h. This file contains the complete implementation in the form of a template class, Block<>, together with a specialization of this template that handles the case of a zero-sized container.
This class was adapted from Matthew Austern's block class as published in Generic Programming and the STL, ISBN 0-201-30956-4, and a similar class, c_array, published by Bjarne Stroustrup in The C++ Programming Language, 3rd Edition, ISBN 0-201-88954-4. The specialization for the case of a zero-length container was provided by Marc Paterno. Walter Brown edited the result for conformance to Zoom standards.