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. 在可以调用OLE之前,必须将当前线程设置为单线程单元(STA)模式,请确保您的Main函数带有STAThreadAttribute

    导入导出功能,在调用ShowDialog时的错误,解决办法如下: WinForm窗体的入口点: /// <summary> /// 应用程序的主入口点. /// </summary& ...

  2. 将字符串拆分为id

    Sql : alter function [fn_splitSTR] ( ), -- 5,6,7 ) -- ',' ) )) as begin declare @splitlen int begin ...

  3. Css学习笔记 (一)

    这几天写了点CSS,大概总结一下,很凌乱,只是加深一下自己的认识. background-position background-position是以容器的左上角为0,0定位,支持(left,righ ...

  4. Android Performance Optimization

    1.zipalign 2.ui优化 3.package size 4.RenderScript 5.Resource Shrinking & Code Shrinking 6.java cod ...

  5. IOS第三方字体

    项目中想使用第三方的字体,在stackoverflow上查询解决办法,也折腾一会,添加成功,示例如下: 1.将xx.ttf字体库加入工程里面 2.在工程的xx-Info.plist文件中新添加一行Fo ...

  6. HttpClient(4.3.3)实例讲解

    HttpClient的作用强大,真的是十分强大. 本实例是基于v4.3.3写的,,作用是模拟登陆后进行上下班打卡,,,使用htmlparser进行解析返回的html文件 关于HttpClient的一些 ...

  7. 通俗理解隐马尔科夫模型HMM(转载)

    作者:Yang Eninala 链接:https://www.zhihu.com/question/20962240/answer/33438846 来源:知乎 著作权归作者所有,转载请联系作者获得授 ...

  8. RelativeLayout.LayoutParams.addRule()方法

    1.应用场景 在使用RelativeLayout布局的时候,通常在载入布局之前在相关的XML文件中进行静态设置即可.但是,在有些情况下,我们需要动态的设置布局 的属性,在不同条件下设置不同的布局排列方 ...

  9. JavaWeb用Jdbc操作MySql数据库(二)

    一.仍然使用前面的环境和示例数据库. 二.建立发出注册请求的页面index3.jsp. <%@ page language="java" import="java. ...

  10. 分布式id 实现方式

    1. uuid 2. twitter的Snowflake 3. MongoDB ObjectID 4. Ticket Server 5. Instagram采用的方式(UUID方式)