摘要: iterator.cpp/*迭代器输入:可读,不一定可改值输出:可改,不一定可读值前向:可读可改双向:支持 --随机:支持--、+n、-n、下标访问*/#include<iterator>#include<iostream>using namespace std;#include<algorithm>#include<vector>#include "print.h"#include<fstream>int main(){ //输入迭代 istream_iterator<int> in(cin);//输 阅读全文
posted @ 2012-10-26 09:27 真爱无限 阅读(304) 评论(0) 推荐(0) 编辑
摘要: //specialcontainer.cpp/*一般容器:stack,queue特殊容器:priority_queue.push(element),.pop(),.empty()stack:.top()queue:.front(),.back()priority_queue:.top()没有迭代器*/#include<iostream>#include<queue>using namespace std;int main(){ priority_queue<int> pq; pq.push(40); pq.push(20); pq.push(10); pq. 阅读全文
posted @ 2012-10-26 08:26 真爱无限 阅读(280) 评论(0) 推荐(0) 编辑
摘要: print.h//print.h#include <iostream>using namespace std;#ifndef print_fun#define print_funtemplate<typename T>///显示序列数据void print(T b,T e,char c=' '){ bool isExit=false; while (b!=e) { cout<<*b++<<c; isExit=true; } if(isExit) cout<<endl;}template<typename K,ty 阅读全文
posted @ 2012-10-26 08:10 真爱无限 阅读(378) 评论(0) 推荐(0) 编辑