Next: Introduction

A General-Purpose Run-Time Type Information System for C++

Alexandru Telea

Abstract:

Since C++ is a statically typed language, operations concerning types have to explicitly precise types at compile-time unless the programmer supplies some 'system' that simulates type variables at run-time. This paper presents such a system which implements type variables (typeids), generalized pointer casting and object construction from run-time supplied typeids. A simple method to add these facilities to any C++ class hierarchy is presented.

The software presented here is available as a very compact, simple to use, library consisting of two small source files, downloadable here. The library can be added to any C++ project and will compile and work with virtually any C++ compiler in existence. It only makes use of the standard C string.h header.





Alexandru Telea