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. Unit Of Work的设计

    在DDD开发过程中,一个良好的Uow设计必不可少,我心目中的Uow设计应该具备以下几点: 1.有着良好的抽象,有着恰如其分的命名: 2.能够应付不同的组件,比如你的系统中可能会存在EfUnitOfWo ...

  2. Linux下常见的IO模型

    前言 阻塞IO(blocking IO) 非阻塞IO(nonblocking IO) IO复用(IO multiplexing) 异步IO(asynchronous IO (the POSIX aio ...

  3. DBUtil数据库连接单例 —— 简单不简单

    单例大概是我最早产生明确模式意识的设计模式,因为它足够简单粗暴,目的足够明确. 单例么,就是不管怎么访问,都返回一个单一实例就好了,我最早应用在数据库的DBUtil中. public class DB ...

  4. angular2系列教程(三)components

    今天,我们要讲的是angualr2的components. 例子

  5. 网页或微信小程序中使元素占满整个屏幕高度

    在项目中经常要用到一个容器元素占满屏幕高度和宽度,然后再在这个容器元素里放置其他元素. 宽度很简单就是width:100% 但是高度呢,我们知道的是height:100%必须是在父元素的高度给定了的情 ...

  6. DOM 事件深入浅出(二)

    在DOM事件深入浅出(一)中,我主要给大家讲解了不同DOM级别下的事件处理程序,同时介绍了事件冒泡和捕获的触发原理和方法.本文将继续介绍DOM事件中的知识点,主要侧重于DOM事件中Event对象的属性 ...

  7. 不懂CSS也能定制博客界面!

    之前没想过定制博客界面,毕竟CSS,HTML什么的都不懂,不过看了这篇文章分分钟搞定: [详细图解]一步一步教你自定义博客园(cnblog)界面 我是基于模板BlueSky做了些改动,先看修改前后的效 ...

  8. WebAPI接收JSON参数注意事项

    运行环境:ASP.NET 4.5.2. 当我们向GlobalConfiguration.Configuration.MessageHandlers添加一个DelegatingHandler派生类后,很 ...

  9. DropDownList实现可输入可选择

    1.js版本 <div style="z-index: 0; visibility: visible; clip: rect(0px 105px 80px 85px); positio ...

  10. spring mvc 和spring security配置 web.xml设置

    <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://xmln ...