This is source code for both the class and template implementations from Christopher Rettig's article “Automatic Units Tracking” (Embedded Systems Programming, April 2001) in which he describes some C++ tips and tricks for tracking, converting, and manipulating data with units. Zip file contains three files: Icon, units_t.h, and unit_types.H. unit_types.H uses templates to create a Units data type. It checks that units are correct at COMPILE time. It hides conversion constants. It enforces self documenting code. The article is available at

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.