TY - CHAP
T1 - Design of Concept Libraries for C++
AU - Sutton, Andrew
AU - Stroustrup, Bjarne
N1 - KAUST Repository Item: Exported on 2020-10-01
Acknowledged KAUST grant number(s): KUS-C1-016-04
Acknowledgements: Thanks to Matt Austern, Paul McJones, Gabriel Dos Reis, andAlex Stepanov for comments that led to major improvements and will be the basis forfurther work. This project was partially supported by NSF grants A3350-32525-CS andA0040-32525-CS and Award KUS-C1-016-04, made by King Abdullah University ofScience and Technology (KAUST).
This publication acknowledges KAUST support, but has no KAUST affiliated authors.
PY - 2012
Y1 - 2012
N2 - We present a set of concepts (requirements on template arguments) for a large subset of the ISO C++ standard library. The goal of our work is twofold: to identify a minimal and useful set of concepts required to constrain the library's generic algorithms and data structures and to gain insights into how best to support such concepts within C++. We start with the design of concepts rather than the design of supporting language features; the language design must be made to fit the concepts, rather than the other way around. A direct result of the experiment is the realization that to simply and elegantly support generic programming we need two kinds of abstractions: constraints are predicates on static properties of a type, and concepts are abstract specifications of an algorithm's syntactic and semantic requirements. Constraints are necessary building blocks of concepts. Semantic properties are represented as axioms. We summarize our approach: concepts = constraints + axioms. This insight is leveraged to develop a library containing only 14 concepts that encompassing the functional, iterator, and algorithm components of the C++ Standard Library (the STL). The concepts are implemented as constraint classes and evaluated using Clang's and GCC's Standard Library test suites. © 2012 Springer-Verlag.
AB - We present a set of concepts (requirements on template arguments) for a large subset of the ISO C++ standard library. The goal of our work is twofold: to identify a minimal and useful set of concepts required to constrain the library's generic algorithms and data structures and to gain insights into how best to support such concepts within C++. We start with the design of concepts rather than the design of supporting language features; the language design must be made to fit the concepts, rather than the other way around. A direct result of the experiment is the realization that to simply and elegantly support generic programming we need two kinds of abstractions: constraints are predicates on static properties of a type, and concepts are abstract specifications of an algorithm's syntactic and semantic requirements. Constraints are necessary building blocks of concepts. Semantic properties are represented as axioms. We summarize our approach: concepts = constraints + axioms. This insight is leveraged to develop a library containing only 14 concepts that encompassing the functional, iterator, and algorithm components of the C++ Standard Library (the STL). The concepts are implemented as constraint classes and evaluated using Clang's and GCC's Standard Library test suites. © 2012 Springer-Verlag.
UR - http://hdl.handle.net/10754/597944
UR - http://link.springer.com/10.1007/978-3-642-28830-2_6
UR - http://www.scopus.com/inward/record.url?scp=84861639915&partnerID=8YFLogxK
U2 - 10.1007/978-3-642-28830-2_6
DO - 10.1007/978-3-642-28830-2_6
M3 - Chapter
SN - 9783642288296
SP - 97
EP - 118
BT - Lecture Notes in Computer Science
PB - Springer Nature
ER -