Template Metaprogramming Techniques for Concept-Based Specialization - Archive ouverte HAL Accéder directement au contenu
Rapport Année : 2012

Template Metaprogramming Techniques for Concept-Based Specialization

Résumé

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.
Fichier principal
Vignette du fichier
RR-10-18.pdf (277.53 Ko) Télécharger le fichier
Origine : Fichiers produits par l'(les) auteur(s)

Dates et versions

hal-00641006 , version 1 (29-11-2011)
hal-00641006 , version 2 (04-03-2012)
hal-00641006 , version 3 (06-06-2012)
hal-00641006 , version 4 (20-12-2012)
hal-00641006 , version 5 (21-12-2012)

Identifiants

  • HAL Id : hal-00641006 , version 4

Citer

Bruno Bachelet, Antoine Mahul, Loïc Yon. Template Metaprogramming Techniques for Concept-Based Specialization. 2012. ⟨hal-00641006v4⟩
218 Consultations
1773 Téléchargements

Partager

Gmail Facebook X LinkedIn More