淡水求咸

博客园已经停止更新,请移步 http://lovecjh.com/

导航

上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 22 下一页

2012年5月18日

大数运算

摘要: 大数运算在面试与笔试中遇到的概率还是蛮大,上次在大华笔试就遇到过。题目:编写一个关于大整型无符号数的加法、乘法的类。#include <iostream>#include <string>#include <deque>#include <functional>#include <algorithm>using namespace std;class MyBigNum{private: deque<int> v; //用deque容器表示的大整数public: MyBigNum(){} MyBigNum(string st 阅读全文

posted @ 2012-05-18 21:42 深圳彦祖 阅读(389) 评论(0) 推荐(0) 编辑

2012年4月19日

C++自增运算符的探索

摘要: 今天在阅读C++ primer时遇到如下一段代码:istream_iterator<int> in_iter(cin);//read ints from cinistream_iterator<int> eof;//istream "end" iterator//read until end of file,storing what read in vecwhile(in_iter != eof){ //increament advances the stream to the nest value //dereferent reads next v 阅读全文

posted @ 2012-04-19 13:35 深圳彦祖 阅读(3434) 评论(0) 推荐(1) 编辑

2012年4月17日

STL之copy函数

摘要: copy函数是STL中常用函数之一。copy函数原型:template<class InputIterator, class OutputIterator> OutputIterator copy( InputIterator _First, InputIterator _Last, OutputIterator _DestBeg );parameters:_FirstAn input iterator addressing the position of the first element in the source range._LastAn in... 阅读全文

posted @ 2012-04-17 17:04 深圳彦祖 阅读(3723) 评论(0) 推荐(0) 编辑

2012年4月16日

命名避免名字冲突

摘要: 今天在写了模板函数时出现下面情况:程序如下:#include <iostream>#include <string>using namespace std;template <class T> void swap(T &a,T &b)//swap already exist in STL{ T temp(a); a=b; b=temp;}int main(){ string a("hello"),b("world"); //int a=1,b=2; swap(a,b); cout<<&quo 阅读全文

posted @ 2012-04-16 20:02 深圳彦祖 阅读(288) 评论(0) 推荐(0) 编辑

2012年4月15日

Detail About How VPTR And Virtual Table Works

摘要: this article is about how vptr and virtual table works,and it comes from http://www.dreamincode.net/forums/topic/45816-detail-about-how-vptr-and-virtual-table-works/Assumption: machine is 32-bit .Here I am going to explain How Virtual table, Virtual pointer for Virtual functions are internally worki 阅读全文

posted @ 2012-04-15 10:50 深圳彦祖 阅读(806) 评论(0) 推荐(0) 编辑

上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 22 下一页