Skip to content
Free planNo credit card requiredStart writing

article · HAL (Le Centre pour la Communication Scientifique Directe) · 2013

Template Metaprogramming Techniques for Concept-Based Specialization

Bruno Bachelet, Antoine Mahul, Loïc Yon

Cited by 0Open access

Abstract

In generic programming, software components are parameterized on types. When available, a static specialization mechanism allows selecting, for a given set of parameters, a more suitable version of a generic component than its primary version. The normal C++ template specialization mechanism is based on the type pattern of the parameters, which is not always the best way to guide the specialization process: type patterns are missing some information on types that could be relevant to define specializations. The notion of a concept, which represents a set of requirements (including syntactic and semantic aspects) for a type, is known to be an interesting approach to control template specialization. For many reasons, concepts were dropped from C++11 standard, this article therefore describes template metaprogramming techniques for declaring concepts, modeling relationships (meaning that a type fulfills the requirements of a concept), and refinement relationships (meaning that a concept refines the requirements of another concept). From a taxonomy of concepts and template specializations based on concepts, an automatic mechanism selects the most appropriate version of a generic component for a given instantiation. Our purely library-based solution is also open for retroactive extension: new concepts, relationships, and template specializations can be defined at any time; such additions will then be picked up by the specialization mechanism.

Cite this paper

APA 7

Bachelet, B., Mahul, A., & Yon, L. (2013). Template Metaprogramming Techniques for Concept-Based Specialization. HAL (Le Centre pour la Communication Scientifique Directe). https://doi.org/10.3233/spr-130362

MLA 9

Bachelet, Bruno, et al. “Template Metaprogramming Techniques for Concept-Based Specialization.” HAL (Le Centre pour la Communication Scientifique Directe), 2013, https://doi.org/10.3233/spr-130362.

Chicago

Bachelet, Bruno, Antoine Mahul, and Loïc Yon. 2013. “Template Metaprogramming Techniques for Concept-Based Specialization.” HAL (Le Centre pour la Communication Scientifique Directe). https://doi.org/10.3233/spr-130362.

Harvard

Bachelet, B., Mahul, A. and Yon, L. (2013) ‘Template Metaprogramming Techniques for Concept-Based Specialization’, HAL (Le Centre pour la Communication Scientifique Directe). Available at: https://doi.org/10.3233/spr-130362.

BibTeX
@article{bachelet2013template,
  title = {{Template Metaprogramming Techniques for Concept-Based Specialization}},
  author = {Bachelet, Bruno and Mahul, Antoine and Yon, Loïc},
  journal = {HAL (Le Centre pour la Communication Scientifique Directe)},
  year = {2013},
  doi = {10.3233/spr-130362}
}

Made from the index record. Check names, capitalisation and page numbers against the paper. Need another style? AI for Research has over 10,000.