...
【24h】

Concepts: linguistic support for generic programming in C++

机译:概念:C ++中通用编程的语言支持

获取原文
获取原文并翻译 | 示例
           

摘要

Generic programming has emerged as an important technique for the development of highly reusable and efficient software libraries. In C++, generic programming is enabled by the flexibility of templates, the C++ type parametrization mechanism. However, the power of templates comes with a price: generic (template) libraries can be more difficult to use and develop than non-template libraries and their misuse results in notoriously confusing error messages. As currently defined in C++98, templates are unconstrained, and type-checking of templates is performed late in the compilation process, i.e., after the use of a template has been combined with its definition. To improve the support for generic programming in C++, we introduce concepts to express the syntactic and semantic behavior of types and to constrain the type parameters in a C++ template. Using concepts, type-checking of template definitions is separated from their uses, thereby making templates easier to use and easier to compile. These improvements are achieved without limiting the flexibility of templates or decreasing their performance - in fact their expressive power is increased. This paper describes the language extensions supporting concepts, their use in the expression of the C++ Standard Template Library, and their implementation in the ConceptGCC compiler. Concepts are candidates for inclusion in the upcoming revision of the ISO C++ standard, C++0x.
机译:泛型编程已成为开发高度可重用和高效的软件库的重要技术。在C ++中,通用编程是通过模板的灵活性(C ++类型参数化机制)来实现的。但是,模板的功能是有代价的:与非模板库相比,通用(模板)库的使用和开发可能会更加困难,并且它们的误用会导致众所周知的错误消息。正如C ++ 98中当前定义的那样,模板不受限制,并且模板的类型检查是在编译过程的后期进行的,即在将模板的使用与其定义结合之后。为了改善对C ++中通用编程的支持,我们引入了一些概念来表达类型的句法和语义行为,并限制C ++模板中的类型参数。使用概念,模板定义的类型检查与使用分开,从而使模板更易于使用和编译。无需限制模板的灵活性或降低其性能即可实现这些改进-实际上,它们的表达能力得到了提高。本文介绍了支持概念的语言扩展,它们在C ++标准模板库的表达中的使用以及在ConceptGCC编译器中的实现。概念是要纳入即将发布的ISO C ++标准C ++ 0x的候选对象。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号