SimpleConcepts: A Lightweight Extension to C++ to Support Constraints on Generic Types

Reed Milewicz1, Marjan Mernik2 and Peter Pirkelbauer3

  1. University of Alabama at Birmingham
    Birmingham, AL 35294
    rmmilewi@cis.uab.edu
  2. University of Maribor
    Slovenia
    marjan.mernik@uni-mb.si
  3. University of Alabama at Birmingham
    Birmingham, AL 35294
    pirkelbauer@uab.edu

Abstract

Generic programming plays an essential role in C++ software through the use of templates. However, both the creation and use of template libraries is hindered by the fact that the language does not allow programmers to specify constraints on generic types. To date, no proposal to update the language to provide concepts has survived the committee process. Until that time comes, as a form of early support, this paper introduces SimpleConcepts, an extension to C++11 that provides support for concepts, sets of constraints on generic types. SimpleConcepts features are parsed according to an island grammar and source-to-source translation is used to lower concepts to pure C++11 code.

Key words

Generic Programming, C++ Templates, C++ Concepts

Digital Object Identifier (DOI)

https://doi.org/10.2298/CSIS131209053M

Publication information

Volume 11, Issue 4 (October 2014)
Special Issue on Advances in Systems, Modeling, Languages and Agents
Year of Publication: 2014
ISSN: 2406-1018 (Online)
Publisher: ComSIS Consortium

Full text

DownloadAvailable in PDF
Portable Document Format

How to cite

Milewicz, R., Mernik, M., Pirkelbauer, P.: SimpleConcepts: A Lightweight Extension to C++ to Support Constraints on Generic Types. Computer Science and Information Systems, Vol. 11, No. 4, 1361–1379. (2014), https://doi.org/10.2298/CSIS131209053M