原创 .*操作符的用法
#include <iostream> #include <algorithm> #include <vector> #include <string> using namespace std; class Widget {
原创 內存拷貝函數不同寫法的效率分析
#include<iostream> #include<algorithm> #include<string> using namespace std; void OverFlow(const int &max) { int &t
原创 成員函數轉換普通函數
#include<algorithm> #include<string> using namespace std; class Widget { string name; public: Widget(string _name):na
原创 調用容器內對象成員函數
#include<boost/lexical_cast.hpp> #include<vector> using namespace std; using namespace boost; class Widget { string na
原创 實現一個功能類似Any的類
#include<iostream> #include<algorithm> #include<string> #include<stdexcept> using namespace std; enum Type{Int,Dou,Str}
原创 模仿mem_fun函數的功能
#include <iostream> #include <algorithm> #include <vector> #include <string> using namespace std; class Widget {
原创 計算字符串的最小後繼
#include <stdio.h> #include <iostream> #include <string> #include <algorithm> using namespace std; string GetString(str
原创 通過函數名調用類的成員函數
#include<iostream> #include<algorithm> #include<string> #include<vector> #include<map> using namespace std; class FuncF
原创 模仿虛函數
#include<iostream> #include<algorithm> #include<string> using namespace std; class Base { public: int funptr; void (
原创 大學
大一時候呆的地方,很小,迷惘的一段時光啊,在學校網吧消費了300塊錢,也努力學習了,上學期掛了4門,下學期忘了,可能掛一門。短短的幾個月經歷了高潮與低谷後明白了,對榮譽太過關注會讓自己很受傷,從那以後把60分定爲自己的目標,同時確立
原创 大小寫轉換函數,位運算的使用
#include<iostream> #include<algorithm> #include<string> #include<string.h> using namespace std; void ToUpper(char *str)
原创 通過vtable指針訪問聲明爲private的虛函數
class Base { private: virtual void f() { cout << "Base::f" << endl; } virtual void g() {
原创 迭代和遞歸計算分數
#include<iostream> #include<algorithm> #include<string> #include<cstring> #include<ctime> #include<windows.h> using nam
原创 李清照詞
點絳脣 寂寞深閨, 柔腸一寸愁千縷。 惜春春去, 幾點催花雨。 倚遍欄干, 只是無情緒! 人何處? 連天衰草, 望斷歸來路。 點絳脣 蹴罷鞦韆, 起來慵整纖纖手。 露濃花瘦, 薄汗輕衣透。
原创 智能指針與STL容器
#include "boost/shared_ptr.hpp" #include <vector> #include <iostream> class A { public: virtual void sing() {