上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 14 下一页

2015年5月30日

【STL源码剖析读书笔记】自己实现Heap算法之MyHeap(底层容器用vector)

摘要: MyHeap.h#ifndef MY_HEAP_H#define MY_HEAP_H#include#include#define max_value -99999999//仿函数templatestruct MyLess{ bool operator()(const T& x, const T& ... 阅读全文

posted @ 2015-05-30 18:47 ruan875417 阅读(213) 评论(0) 推荐(0) 编辑

2015年5月29日

【STL源码剖析读书笔记】自己实现queue之MyQueue(底层用MyList)

摘要: MyList.h#ifndef MY_LIST_H#define MY_LIST_H#include//list的node结构templatestruct list_node{ typedef list_node* pointer; pointer prev; pointer next; T dat... 阅读全文

posted @ 2015-05-29 20:18 ruan875417 阅读(345) 评论(0) 推荐(0) 编辑

【STL源码剖析读书笔记】自己实现stack之MyStack(底层用MyList)

摘要: MyList.h#ifndef MY_LIST_H#define MY_LIST_H#include//list的node结构templatestruct list_node{ typedef list_node* pointer; pointer prev; pointer next; T dat... 阅读全文

posted @ 2015-05-29 18:22 ruan875417 阅读(228) 评论(0) 推荐(0) 编辑

【STL源码剖析读书笔记】自己实现list之MyList

摘要: MyList.h#ifndef MY_LIST_H#define MY_LIST_H#include#include//list的节点结构templatestruct list_node{ typedef list_node* pointer; pointer prev; pointer next;... 阅读全文

posted @ 2015-05-29 14:50 ruan875417 阅读(204) 评论(0) 推荐(1) 编辑

2015年5月28日

【STL源码剖析读书笔记】自己实现vector之MyVector

摘要: MyVector.h#ifndef MY_VECTOR_H#define MY_VECTOR_H#define _SCL_SECURE_NO_WARNINGS //为了防止在VS2013中报错#include //ptrdiff_t#includetemplatevoid destroy(T* pt... 阅读全文

posted @ 2015-05-28 15:07 ruan875417 阅读(289) 评论(0) 推荐(0) 编辑

2015年5月27日

【leetcode】【单链表】【160】Intersection of Two Linked Lists

摘要: #includeusing namespace std;struct ListNode { int val; ListNode *next; ListNode(int x) : val(x), next(NULL) {}};class Solution {public: ListNode *getI... 阅读全文

posted @ 2015-05-27 20:48 ruan875417 阅读(96) 评论(0) 推荐(0) 编辑

【STL源码剖析读书笔记】自己实现简单的空间配置器MyAllocator

摘要: MyAllocator.h#ifndef MY_ALLOCATOR_H#define MY_ALLOCATOR_H#include //placement new#include //ptrdiff_t size_t//分配内存templateinline T* _allocator(ptrdiff... 阅读全文

posted @ 2015-05-27 18:55 ruan875417 阅读(172) 评论(0) 推荐(0) 编辑

【STL源码剖析读书笔记】【第8章】配接器

摘要: 1、 设计模式中对配接器的定义如下:将一个class的接口转换为另一个class的接口,使原本因接口不兼容而不能合作的classes可以一起运作。2、 容器配接器stack和queue是两个容器配接器,底层默认由deque构成。stack封住了所有的deque对外接口,只开放符合stack原则的几个... 阅读全文

posted @ 2015-05-27 10:12 ruan875417 阅读(190) 评论(0) 推荐(0) 编辑

2015年5月26日

【STL源码剖析读书笔记】【第7章】仿函数

摘要: 1、仿函数也叫作函数对象,是一种具有函数特质的对象,调用者可以像函数一样地调用这些对象。仿函数必须重载operator()。2、 STL中仿函数代替函数指针的原因在于函数指针不能满足STL对抽象性的要求,也不能满足软件积木的要求,函数指针无法与STL其他组件搭配。3、 STL仿函数与STL算法之间的... 阅读全文

posted @ 2015-05-26 11:47 ruan875417 阅读(161) 评论(0) 推荐(0) 编辑

【STL源码剖析读书笔记】【第6章】算法之inplace_merge算法

摘要: 1、 inplace_merge()函数将两个连接在一起的排序序列[first, middle)和[middle, last)结合成单一序列并保持有序。inplace_merge()函数是stable操作。2、 inplace_merge()版本一的源代码,只讨论了有暂时缓冲区的情况template... 阅读全文

posted @ 2015-05-26 10:37 ruan875417 阅读(318) 评论(0) 推荐(0) 编辑

上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 14 下一页

导航