Reflection Support by Means of Template Metaprogramming

  • Authors:
  • Giuseppe Attardi;Antonio Cisternino

  • Affiliations:
  • -;-

  • Venue:
  • GCSE '01 Proceedings of the Third International Conference on Generative and Component-Based Software Engineering
  • Year:
  • 2001

Quantified Score

Hi-index 0.00

Visualization

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.