首页 | 本学科首页   官方微博 | 高级检索  
     

元组容器在C++中的设计与实现
引用本文:王轶凡,陈章龙.元组容器在C++中的设计与实现[J].计算机工程与设计,2005,26(3):770-773,776.
作者姓名:王轶凡  陈章龙
作者单位:复旦大学,计算机科学与工程系,上海,200433
摘    要:C 是一种静态类型语言,这就使实现可以容纳不同种类型元素的容器——元组变得十分困难。C 的标准容器库STL虽然提供了丰富的容器,但其都只能容纳相同类型的元素,没有提供对元组容器的支持。其实C 的模板机制为它的静态类型系统增加了很大的灵活性,再使用一些其它的技巧,使得实现元组容器成为可能。wyf::tuple就是如此实现的一个元组容器的程序库。wyf::tuple不但可以保证类型安全,并且是高效的。测试数据表明,它要比一些动态语言如Python中的类似容器高效得多。

关 键 词:元组  C++  类型系统  程序库  STL  容器  测试数据  同类  元素  困难
文章编号:1000-7024(2005)03-0770-04

Design and implementation of tuple in C++
WANG Yi-fan,CHEN Zhang-long.Design and implementation of tuple in C++[J].Computer Engineering and Design,2005,26(3):770-773,776.
Authors:WANG Yi-fan  CHEN Zhang-long
Abstract:To implement tuple in C++ is very difficult, because of its static type system. STL has many containers, but it does not include tuple. However, the template enhances the flexibility of static type system greatly. Using template and some other techniques, it is possible to design a tuple. WYF:: tuple is container using this approach. It is type-safe and effective. The performance tests show that wyf:: type is far more effective than the similar container in such dynamic language like python.
Keywords:C++  template  tuple  
本文献已被 CNKI 维普 万方数据 等数据库收录!
设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号