Visualization of C++ Template Metaprograms

Template metaprograms have become an essential part of today's C++ programs: with proper template definitions we can force the C++ compiler to execute algorithms at compilation time. Among the application areas of template metaprograms are the expression templates, static interface checking, code optimization with adaptation, language embedding and active libraries. Despite all of its already proven benefits and numerous successful applications there are surprisingly few tools for creating, supporting, and analyzing C++ template metaprograms. As metaprograms are executed at compilation time they are even harder to understand. In this paper we present a code visualization tool, which is utilizing Tem plight, our previously developed C++ template metaprogram debugger. Using the tool it is possible to visualize the instantiation chain of C++ templates and follow the execution of metaprograms. Various presentation layers, filtering of template instances and step-by-step replay of the instantiations are supported. Our tool can help to test, optimize, maintain C++ template metaprograms, and can enhance their acceptance in the software industry.

[1]  David Abrahams,et al.  C++ template metaprogramming , 2005 .

[2]  Alexandru Telea,et al.  Extraction and visualization of call dependencies for large C/C++ code bases: A comparative study , 2009, 2009 5th IEEE International Workshop on Visualizing Software for Understanding and Analysis.

[3]  Jeremy G. Siek,et al.  A language for generic programming , 2005 .

[4]  Bjarne Stroustrup,et al.  C++ Programming Language , 1986, IEEE Softw..

[5]  Krzysztof Czarnecki,et al.  Generative programming - methods, tools and applications , 2000 .

[6]  David Abrahams,et al.  C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and Beyond (C++ In-Depth Series) , 2004 .

[7]  Graham J. Wills,et al.  NicheWorks - Interactive Visualization of Very Large Graphs , 1997, GD.

[8]  Jeremy G. Siek,et al.  Essential language support for generic programming , 2005, PLDI '05.

[9]  Lucian Voinea,et al.  An interactive reverse engineering environment for large-scale C++ code , 2008, SoftVis '08.

[10]  Péter Kovács,et al.  LEMON - an Open Source C++ Graph Template Library , 2011, WGT@ETAPS.

[11]  Todd L. Veldhuizen Five compilation models for C++ templates , 2000 .

[12]  Alexander A. Stepanov,et al.  Algorithm‐oriented generic libraries , 1994, Softw. Pract. Exp..

[13]  James Haungs Addendum to the 1998 proceedings of the conference on Object-oriented programming, systems, languages, and applications (Addendum) , 1998, OOPSLA 1998.

[14]  Bjarne Stroustrup,et al.  Specifying C++ concepts , 2006, POPL '06.

[15]  Jeremy G. Siek,et al.  Concept Checking: Binding Parametric Polymorphism in C++ , 2000 .

[16]  Todd L. Veldhuizen,et al.  Expression templates , 1996 .

[17]  Björn Karlsson,et al.  Beyond the C++ Standard Library: An Introduction to Boost , 2005 .

[18]  Douglas Gregor,et al.  C++ Templates: The Complete Guide , 2002 .

[19]  Danny Holten,et al.  Hierarchical Edge Bundles: Visualization of Adjacency Relations in Hierarchical Data , 2006, IEEE Transactions on Visualization and Computer Graphics.

[20]  Robert Glück,et al.  Generative Programming and Active Libraries , 1998, Generic Programming.

[21]  Bjarne Stroustrup,et al.  The C++ Programming Language: Special Edition , 2000 .

[22]  Zoltán Porkoláb,et al.  Towards a General Template Introspection Library , 2004, GPCE.

[23]  Yannis Smaragdakis,et al.  Static interfaces in C , 2000 .

[24]  Zoltán Porkoláb,et al.  Debugging C++ template metaprograms , 2006, GPCE '06.

[25]  Todd L. Veldhuizen,et al.  Using C++ template metaprograms , 1996 .

[26]  Arturo J. Sánchez,et al.  Towards a graphical notation to express the C++ template instantiation process (poster session) , 2000, OOPSLA '00.

[27]  Andrei Alexandrescu,et al.  Modern C++ design: generic programming and design patterns applied , 2001 .