...
首页> 外文期刊>C - C++ Users Journal >Ranges, Part 2: Iterable Range Adaptors, Algorithms, and Composition
【24h】

Ranges, Part 2: Iterable Range Adaptors, Algorithms, and Composition

机译:范围,第2部分:可迭代范围适配器,算法和组成

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

摘要

STL introduced a wonderfully novel idea — separating algorithms from the containers. Thus, iterators were born, and yes, they have proven to be of great use. However, if you try to use them in nontriv-ial cases such as iterator composition (say to filter a vector, transform each resulting element, and then use it), they become hard to use. Moreover, when you use iterators in algorithms, you always have to specify some_array.begin() and some_array.end(). This can be tedious and makes code much less readable. Furthermore, when you code manual loops, again, the code is verbose, error prone, spans over multiple lines, and is hard to read. But don't worry — ranges are here to help!
机译:STL引入了一个奇妙的新主意-将算法与容器分离。因此,迭代器诞生了,是的,事实证明,迭代器很有用。但是,如果尝试在迭代器组合之类的非特殊情况下使用它们(例如过滤矢量,转换每个结果元素然后使用它),则它们将变得难以使用。此外,在算法中使用迭代器时,始终必须指定some_array.begin()和some_array.end()。这可能很乏味,并使代码的可读性大大降低。此外,当您编写手动循环代码时,该代码又很冗长,容易出错,跨越多行并且很难阅读。但请放心-范围对您有所帮助!

著录项

相似文献

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

客服邮箱:kefu@zhangqiaokeyan.com

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

  • 服务号