【24h】

C++ Metastring Library and Its Applications

机译:C ++ MetaString库及其应用程序

获取原文

摘要

C++ template metaprogramming is an emerging direction of generative programming: with proper template definitions we can enforce the C++ compiler to execute algorithms at compilation time. Template metaprograms have become essential part of today's C++ programs of industrial size; they provide code adoptions, various optimizations, DSL embedding, etc. Besides the compilation time algorithms, template metaprogram data-structures are particularly important. From simple typelists to more advanced STL-like data types there are a variety of such constructs. Interesting enough, until recently string, as one of the most widely used data type of programming, has not been supported. Although, boost string is an advance in this area, it still lacks the most fundamental string operations. In this paper, we analysed the possibilities of handling string objects at compilation time with a metastring library. We created a C++ template metaprogram library that provides the common string operations, like creating sub-strings, concatenation, replace, and similar. To provide real-life use-cases we implemented two applications on top of our Metastring library. One use case utilizes compilation time inspection of input in the domain of pattern matching algorithms, thus we are able to select the more optimal search method at compilation time. The other use-case implements safe Print, a type-safe version of printf - a widely investigated problem. We present both the performance improvements and extended functionality we have achieved in the applications of our Metastring library.
机译:C ++模板元编程是产生式编程的一个新兴方向:适当的模板定义,我们可以执行C ++编译器在编译时执行的算法。模板元程序已经成为今天的C ++工业规模的计划重要组成部分;他们提供的代码收养,各种优化,DSL嵌入等。此外编译时间算法,模板元编程数据结构是特别重要的。从简单的类型串,以更先进的STL类数据类型有很多种这样的构造。有意思的是,直到最近的字符串,作为节目的最广泛使用的数据类型之一,并没有得到支持。虽然,升压串在这方面的进步,但仍然缺乏最基本的字符串操作。在本文中,我们分析了在编译时有metastring库处理字符串对象的可能性。我们创建了一个C ++模板元编程库,提供了常见的字符串操作,如创建子串,拼接,更换,以及类似的。为了提供真实使用情况,我们实施了我们的Metastring库顶两个应用程序。一个用例利用在模式匹配算法的域输入的编译时间检查,因此,我们能够选择在编译时的更优化的搜索方法。其他用例工具安全打印,printf函数类型安全的版本 - 一个被广泛研究的问题。我们目前无论是性能改进和扩展功能,我们在Metastring库的应用程序已经实现。

著录项

相似文献

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

客服邮箱:kefu@zhangqiaokeyan.com

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

  • 服务号