当前位置: X-MOL 学术Sci. Program. › 论文详情
Our official English website, www.x-mol.net, welcomes your feedback! (Note: you will need to create a separate account there.)
Template Metaprogramming Techniques for Concept-Based Specialization
Scientific Programming ( IF 1.672 ) Pub Date : 2013 , DOI: 10.3233/spr-130362
Bruno Bachelet, Antoine Mahul, Loïc Yon

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.

中文翻译:

基于概念的专业化模板元编程技术

在通用编程中,软件组件按类型进行参数化。当可用时,静态专业化机制允许为给定的一组参数选择比其主要版本更通用的通用组件版本。常规的C ++模板专业化机制是基于参数的类型模式的,这并不总是指导专业化过程的最佳方法:类型模式缺少有关类型的某些信息,这些信息可能与定义专业化有关。代表一种类型的一组要求(包括句法和语义方面)的概念概念是控制模板专业化的一种有趣方法。由于多种原因,概念已从C ++ 11标准中删除,因此本文介绍了用于声明概念的模板元编程技术,建模关系(意味着一个类型满足一个概念的要求)和细化关系(意味着一个概念完善另一个概念的要求)。根据概念分类和基于概念的模板专业化,自动机制针对给定的实例选择通用组件的最合适版本。我们的纯粹基于库的解决方案也可以进行追溯扩展:可以随时定义新概念,关系和模板专业化;这样的添加将由专业化机制处理。从概念分类和基于概念的模板专业化中,自动机制针对给定的实例选择通用组件的最合适版本。我们的纯粹基于库的解决方案也可以进行追溯扩展:可以随时定义新概念,关系和模板专业化;这样的添加将由专业化机制处理。从概念分类和基于概念的模板专业化中,自动机制针对给定的实例选择通用组件的最合适版本。我们的纯粹基于库的解决方案也可以进行追溯扩展:可以随时定义新概念,关系和模板专业化;这样的添加将由专业化机制处理。
更新日期:2020-09-25
down
wechat
bug