Support for the evolution of C++ generic functions

  • Authors:
  • Peter Pirkelbauer;Damian Dechev;Bjarne Stroustrup

  • Affiliations:
  • Lawrence Livermore National Laboratory, Center for Applied Scientific Computing, Livermore, CA;University of Central Florida, Department of Electrical Engineering and Computer Science, Orlando, FL;Texas A&M University, Department of Computer Science and Engineering, College Station, TX

  • Venue:
  • SLE'10 Proceedings of the Third international conference on Software language engineering
  • Year:
  • 2010

Quantified Score

Hi-index 0.00

Visualization

Abstract

The choice of requirements for an argument of a generic type or algorithm is a central design issue in generic programming. In the context of C++, a specification of requirements for a template argument or a set of template arguments is called a concept. In this paper, we present a novel tool, TACE (template analysis and concept extraction), designed to help programmers understand the requirements that their code de facto imposes on arguments and help simplify and generalize those through comparisons with libraries of well-defined and precisely-specified concepts. TACE automatically extracts requirements from the body of function templates. These requirements are expressed using the notation and semantics developed by the ISO C++ standards committee. TACE converts implied requirements into concept definitions and compares them against concepts from a repository. Components of a well-defined library exhibit commonalities that allow us to detect problems by comparing requirements from many components: Design and implementation problems manifest themselves as minor variations in requirements. TACE points to source code that cannot be constrained by concepts and to code where small modifications would allow the use of less constraining concepts. For people who use a version of C++ with concept support, TACE can serve as a core engine for automated source code rejuvenation.