
doi: 10.1002/spe.2483
SummaryConcepts are likely to be introduced in a future C++ standard. They can be used for constraining template parameters, which enables checking requirements on template parameters sooner in the compilation process, and thus providing more intelligible error messages to the user. They can also be used in the specialization of templates, thus leading to a better control over the selection of the most appropriate version of a template for a given instantiation. This latter aspect offers new possibilities in the design of template libraries, as it enhances the specialization mechanism of templates, and set it up as a solid alternative to inheritance when static binding can replace dynamic binding. This article addresses the design of expression templates (i.e., templates that represent expressions and are usually built through operator overloading) that are useful to develop an embedded domain specific language (EDSL), and can speed up the evaluation of an expression by delaying the evaluation of intermediate operations to avoid unnecessary temporary objects. We propose to use concept‐based template specialization to parse expression templates in order to ease the design of an EDSL. This approach is a static variant of the well‐known visitor design pattern that replaces the overridden methods in the double dispatch of the original design pattern by template specializations based on concepts. An example of EDSL for linear programming developed with our solution demonstrates that a concept‐based design helps producing concise and reliable code. Copyright © 2017 John Wiley & Sons, Ltd.
[INFO.INFO-SE] Computer Science [cs]/Software Engineering [cs.SE], programmation générique, template metaprogramming, [INFO.INFO-PL] Computer Science [cs]/Programming Languages [cs.PL], métaprogrammation par patrons, spécialisation de patron, template specialization, spécialisation orientée concept, concept-based specialization, expression templates, generic programming, patrons d’expression
[INFO.INFO-SE] Computer Science [cs]/Software Engineering [cs.SE], programmation générique, template metaprogramming, [INFO.INFO-PL] Computer Science [cs]/Programming Languages [cs.PL], métaprogrammation par patrons, spécialisation de patron, template specialization, spécialisation orientée concept, concept-based specialization, expression templates, generic programming, patrons d’expression
| selected citations These citations are derived from selected sources. This is an alternative to the "Influence" indicator, which also reflects the overall/total impact of an article in the research community at large, based on the underlying citation network (diachronically). | 0 | |
| popularity This indicator reflects the "current" impact/attention (the "hype") of an article in the research community at large, based on the underlying citation network. | Average | |
| influence This indicator reflects the overall/total impact of an article in the research community at large, based on the underlying citation network (diachronically). | Average | |
| impulse This indicator reflects the initial momentum of an article directly after its publication, based on the underlying citation network. | Average |
