Reflection Support by Means of Template MetaprogrammingGiuseppe Attardi and Antonio Cisternino Dipartimento di Informatica, corso Italia 40, I-56125
Pisa, Italy Abstract. The C++ language has only a limited runtime type information system, which doesn't provide full reflection capabilities. We present a general mechanism to support reflection, exploiting template metaprogramming techniques. Two solutions are presented: a static one where metaclass information is only available at compile time to produce class specific code; and a dynamic one where metaclass objects exist at runtime. As a case study of technique we show how to build an object interface to relational database tables. By just annotating a class definition with meta information, such as storage attributes or index properties of fields, a programmer can define objects that can be stored, fetched or searched in a database table. This approach has been used in building a high-performance, full text search engine. LNCS 2186, p. 118 ff. Full article in PDF (63 KB) Online publication: August 24, 2001 |