The function concept in C++: an empirical study

  • Authors:
  • Daniel Lincke;Sibylle Schupp

  • Affiliations:
  • Potsdam Institute for Climate Impact Research, Potsdam, Germany;Hamburg University of Technology, Hamburg, Germany

  • Venue:
  • Proceedings of the 2009 ACM SIGPLAN workshop on Generic programming
  • Year:
  • 2009

Quantified Score

Hi-index 0.00

Visualization

Abstract

Higher-order functions are essential for generic programming. While they are naturally supported in functional programming languages, there are no higher-order functions in C++. There, various function datatypes exist that simulate the effect of higher-order programming in different ways - as classes designed in the imperative, object-oriented, or meta-programming spirit. With the recent addition of concepts, another alternative for supporting parameterization by functions has yet become available. No guidelines exist, however, whether, or when, to prefer a concept for functions over any of the existing function datatypes; nor have the function datatypes themselves been compared. We provide an empirical study that assesses performance, expressivity, and convenience. The study shows that the function concept mechanism is faster and at least as expressive as the best function datatype, but, due to the principal difference between concept- and type-based approaches, also less convenient to use.