The concept of STL is based on a separation of data and operations. The data is managed by container classes, and the operations are defined by configurable algorithms. Iterators are the glue between these two components and they let any algorithm interact with any container.

//violate using the iterator as the glue between the containers and the algorithm 
template<T>
Print(List<T> & container)
{
    for(T item: container)
     {
        //...
     }
}
 
//correct
template<T>
Print(iterator<T> begin, iterator<T> end)
{
    for(;begin < end && begin != end; begin ++)
    {
        //...
    }
}
  1. The STL concept contradicts the original idea of object-oriented programming: the STL serarates data and algorithms rather than combining them. While you can combine every kinds of container with ever kind of algorithm, so the result is a very flexible but still rather small framework.
  2. The particular implementation of any container is not defined by the C++ standard library. However, the behavior and complexity secified by the standard do not leave much room for variation.
  3. The STL containers provide only those special member functions that in general have "good" performance, where "good" normal means constant or logarithmic complexity. e.g., a direct element access by using operator [] is not provided for lists. This is because lists don't provide random access, and so an operator [] would have bad performance. Which is also most like why there is no resize() for array.

the philosophy behind of the design of the STL的更多相关文章

  1. Range-Based for Loops

    for ( decl : coll ) { statement } where decl is the declaration of each element of the passed collec ...

  2. bullet HashMap 内存紧密的哈希表

    last modified time:2014-11-9 14:07:00 bullet 是一款开源物理引擎,它提供了碰撞检測.重力模拟等功能,非常多3D游戏.3D设计软件(如3D Mark)使用它作 ...

  3. Effective STL 学习笔记: Thread Safety and STL Container

    Table of Contents 1. STL, Thread and SGI 2. STL and Lock 2.1. RAII 2.2. Use Lock in STL 1 STL, Threa ...

  4. spring ref &history&design philosophy

    Spring Framework Overview Spring是开发java application的通用框架,分为多个模块(modules),核心是core container,包括configu ...

  5. Spring history&Design Philosophy 简单介绍~

    SPRING框架的介绍和历史 Spring Framework是一个开源Java应用程序框架,最初是基于依赖注入(DI)和控制反转(IoC)的原理开发的. Spring Framework已经成长为控 ...

  6. spring ref history Design philosophy

    一.前言 Spring 框架可以说是 Java 开发人员使用的最流行的应用程序开发框架之一.它目前由大量提供一系列服务的模块组成.包括模块容器,为构建横切关注点提供支持的面向切面编程(AOP),安全框 ...

  7. spring history &design Philosophy

    Spring简介 Spring是一个开源框架,它由Rod Johnson创建.它是为了解决企业应用开发的复杂性而创建的.Spring使用基本的JavaBean来完成以前只可能由EJB完成的事情.然而, ...

  8. design philosophy

  9. A Proof of Stake Design Philosophy - PoS权益证明设计理念

    之前在EthFans上看到了关于PoS(权益证明)的相关文章(原文链接),本着学习的态度,对这篇文章进行了翻译.第一次翻译关于区块链的文章,有些单词及句子的措辞还不是很准确,如果发现有翻译的不恰当的地 ...

随机推荐

  1. JavaScript 数组的创建

    数组定义:数组(array)是一种数据类型,它包含或者存储了编码的值,每个编码的值称作该数组的一个元素(element), 每个元素的编码被称作为下标(index). JavaScript一维数组创建 ...

  2. 搭建web服务器环境

    一. 安装apache 安装好之后测试:浏览器地址栏输入:localhost,若弹出"It works!"表明已成功安装. 管理方式:1.通过Apache自带的镜像管理器:2.wi ...

  3. 【转】nginx+tomcat+memcached (msm)实现 session同步复制

    出现session不同步时,请放到content.xml中,实际验证有效: tomcat + memcached + nginx 实现session共享 这里重点强调如何实现linux服务器上 服务器 ...

  4. WCF 服务器调用回调函数 单程-双程操作模式:(待补充Demo)

    服务器端Server 实现回调接口Interface定义.客户端实现回调接口Interface实现,从而实现服务器端通过  var channel = OperationContent.Current ...

  5. 嵌入式linux应用开发完全手册学习笔记一

    2015.3.25星期三 晴 有两个星期没写学习日记了,找个时间把这段时间做的电子词典和ARM小项目总结一下. 下面的知识点总结,U-BOOT:参考PDF文档:嵌入式linux应用开发完全手册 当虚拟 ...

  6. Boundaries

    Using Third-Party Code There is a natural tension between the provider of an interface and the user ...

  7. Unity Sprite转Prefab

    新项目使用Unity5.X,遇到了一些问题,其中就有Sprite的管理更新问题,查了一些资料,Mono推荐的是转为Prefab处理. 看了一些国外同行的处理方法,分析了一个编辑器插件脚本.学到了一些技 ...

  8. 黑马程序员:Java编程_反射技术

    =========== ASP.Net+Android+IOS开发..Net培训.期待与您交流!=========== Java类用于描述一类事物的共性,该类事物有什么属性,没有什么属性,至于这个属性 ...

  9. 第二个Sprint冲刺团队贡献分

    201306114322 邵家文 50分 201306114319 陈俊金 10分 201306114320 李新    10分 201306114324 朱浩龙 10分

  10. Java常量字符串String理解

    Java常量字符串String理解 以前关于String的理解仅限于三点:1.String 是final类,不可继承2.String 类比较字符串相等时时不能用“ == ”,只能用  "eq ...