C++98:

1、相同点:

Allocators having the same type were assumed to be equal so that memory allocated by one
allocator could be deallocated by another allocator of the same type.

It was not possible to change the memory resource at runtime.
Allocators had limitations in the ability to hold a state, such as bookkeeping information or
information about where to allocate next.

2、区别:

Allocators were not swapped when the containers were swapped.

Allocators were not handled consistently, because copy constructors copied allocators, whereas
the assignment operator did not. Thus, the copy constructor did not have the same effect as
calling the default constructor and the assignment operator afterward.

C++11:

A couple of proposed changes to C++11 are intended to solve all these issues. For example:
• Library components are no longer allowed to assume that all allocators of a specific type compare
equal.
• Allocator traits solve some of the problems created by stateful allocators.
• A scoped allocator adapter provides the ability used to propagate the allocator from the container
to the contained elements.
These enhancements provide the tools to build a polymorphic allocator, which allows to compare or
assign two containers with different allocator types that are derived from a common allocator type
the container uses. However, due to time constraints, a standard polymorphic allocator is not part of
C++11.

而STL Container在create时可以指定criterion

copy和assign的时候许指定Criterion,否则使用默认项

swap的时候尽可能交换sorting criterion, equivalence predicate,and hash function object

Allocators与Criterion的相同点及区别的更多相关文章

  1. c#中抽象类(abstract)和接口(interface)的相同点与区别

    相同点: 1.都可以被继承 2.都不能被实例化 3.都可以包含方法声明 4.派生类必须实现未实现的方法 区别: 1.抽象基类可以定义字段.属性.方法实现.接口只能定义属性.索引器.事件.和方法声明,不 ...

  2. js里面setInterval和setTimeout相同点和区别

    相同点:两个方法都是先触发间隔时间,再触发回调函数 区别: 1.setInterval每隔指定的时间就执行一次表达式,若不停止会一直执行下去 而setTimeout在执行时,是在载入后延迟指定时间后, ...

  3. g++和gcc的相同点和区别

    gcc和g++的区别和联系 gcc和g++都是GNU(一个组织)的编译器. 1.对于.c后缀的文件,gcc把它当做是C程序:g++当做是C++程序: 2.对于.cpp后缀的文件,gcc和g++都会当做 ...

  4. ES6 let和const 的相同点与区别

    相同点: 1. 一旦声明 值不能再改变,即不能重复声明. 2.不存在变量提升. 3.都存在暂时性死区. 不同点: 1.const声明的变量不得改变值,这意味着,const一旦声明变量,就必须立即初始化 ...

  5. SCP和SFTP相同点和区别

    都是使用SSH协议来传输文件的.不用说文件内容,就是登录时的用户信息都是经过SSH加密后才传输的,所以说SCP和SFTP实现了安全的文件传输. SCP和CP命令相似,SFTP和FTP的使用方法也类似. ...

  6. c#中抽象类和接口的相同点跟区别

    下面是自己写的一个demo,体现抽象类和接口的用法. using System; using System.Collections.Generic; using System.Linq; using ...

  7. 12.C# 接口和抽象类的区别

    1.抽象类 声明方法的存在而不去实现它的类叫做抽象类,抽象类用abstract关键字声明.抽象类主要用来规定某些类的基本特征,继承它的子类必须实现抽象类的抽象成员,否则这个子类也为抽象类. publi ...

  8. Java集合实现类区别与联系

    ArrayList和LinkList相同点和区别: 共性: 都实现了List接口,都是list的实现类,处理list集合操作. 区别: ArrayList:底层存储结构是数组,每个元素都有index标 ...

  9. HttpClient和HttpURLConnection的使用和区别(上)

    转自:点击打开链接 相信很多Android开发者碰到涉及到Http协议的需求时,都和我一样在犹豫是使用HttpClient还是使用HttpURLConnection呢.我在网上也搜索了很多文章,来分析 ...

随机推荐

  1. 自制文件上传JS控件,支持IE、chrome、firefox etc.

    (function() { if (window.FileUpload) { return; } window.FileUpload = function (id, url) { this.id = ...

  2. 前端构建大法 Gulp 系列 (四):gulp实战

    前端构建大法 Gulp 系列 (一):为什么需要前端构建 前端构建大法 Gulp 系列 (二):为什么选择gulp 前端构建大法 Gulp 系列 (三):gulp的4个API 让你成为gulp专家 前 ...

  3. 新编码神器Atom使用纪要

    Atom是 Github 专门为程序员推出的一个跨平台文本编辑器.她很大程度上继承了SublimeText的美,而又不仅如此.有费了蛮大力气总结了一篇关于SublimeText文章: 如何优雅地使用S ...

  4. [Java面经] 关于面试的二三事.

    今天终于闲下来了, 那么也好总结下这几天面试的经历.四天的时间一共面了七家, 有一家是自己推迟了没有去.声明:如若转载请注明出处:http://www.cnblogs.com/wang-meng/p/ ...

  5. Android开发-之监听button点击事件

    一.实现button点击事件的方法 实现button点击事件的监听方法有很多种,这里总结了常用的四种方法: 1.匿名内部类 2.外部类(独立类) 3.实现OnClickListener接口 4.添加X ...

  6. CSS画图

    The Shapes of CSS All of the below use only a single HTML element. Any kind of CSS goes, as long as ...

  7. MVC5 网站开发之六 管理员 1、登录、验证和注销

    上次业务逻辑和展示层的架构都写了,可以开始进行具体功能的实现,这次先实现管理员的登录.验证和注销功能. 目录 奔跑吧,代码小哥! MVC5网站开发之一 总体概述 MVC5 网站开发之二 创建项目 MV ...

  8. 计算机程序的思维逻辑 (33) - Joda-Time

    Joda-Time上节介绍了JDK API中的日期和时间类,我们提到了JDK API的一些不足,并提到,实践中有一个广泛使用的日期和时间类库,Joda-Time,本节我们就来介绍Joda-Time.俗 ...

  9. 分享个 之前写好的 android 文件流缓存类,专门处理 ArrayList、bean。

    转载麻烦声明出处:http://www.cnblogs.com/linguanh/ 目录: 1,前序 2,作用 3,特点 4,代码 1,前序  在开发过程中,client 和 server 数据交流一 ...

  10. Vertica节点宕机处理一例

    Vertica节点宕机处理一例: 查询数据库版本和各节点状态 常规方式启动宕机节点失败 进一步查看宕机节点的详细日志 定位问题并解决 1. 查询数据库版本和各节点状态 dbadmin=> sel ...