摘要:#include #include class Woman; class Man{ private: std::weak_ptr _wife; //std::shared_ptr _wife; public: void setWife(std::shared_ptr &woman){ _wife = woman; } v...
阅读全文
09 2016 档案
摘要:#include <iostream> using namespace std; class Singleton { public: static Singleton *GetInstance() { if (m_Instance == NULL) { m_Instance = new Single
阅读全文
摘要:#include<iostream> using namespace std; // 定义仅由HasPtr类使用的U_Ptr类,用于封装使用计数和相关指针 // 这个类的所有成员都是private,我们不希望普通用户使用U_Ptr类,所以它没有任何public成员 // 将HasPtr类设置为友元,
阅读全文
摘要:怎么处理一行空格中的逗号, 使用c++的方法,可以这么处理: #include <sstream> #include<algorithm> using namespace std; 将数据放入string dataline中, replace(dataline.begin,dataline.end(
阅读全文
摘要:http://www.cnblogs.com/tianyajuanke/archive/2013/02/16/2610276.html 通用步骤: 编译时,可以不知钉头文件,如果指定头文件,其作用是当此头文件变化时,重新生成该规则。如果不知道头文件,则当头文件改动时,只能先clean再make。 编
阅读全文
摘要:Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of Sis 1000, and there exists one unique longest
阅读全文