Concept-controlled polymorphism

  • Authors:
  • Jaakko Järvi;Jeremiah Willcock;Andrew Lumsdaine

  • Affiliations:
  • Open Systems Laboratory, Indiana University, Bloomington, IN;Open Systems Laboratory, Indiana University, Bloomington, IN;Open Systems Laboratory, Indiana University, Bloomington, IN

  • Venue:
  • Proceedings of the 2nd international conference on Generative programming and component engineering
  • Year:
  • 2003

Quantified Score

Hi-index 0.00

Visualization

Abstract

Concepts--sets of abstractions related by common requirements-- have a central role in generic programming. This paper proposes a general framework for using concepts to control polymorphism in different ways. First, concepts can be used to constrain parametric polymorphism, as exemplified by type classes in Haskell. Second, concepts can be used to provide fine-grained control of function and operator overloading. Finally, generic functions can be overloaded (specialized) based on concepts, rather than simply on types. We describe a C++ implementation of a new mechanism, which we call enable_if, and its role in concept-controlled polymorphism.