cpp
李嘉图mTONG
- -
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
单例
#include using namespace std;template class Singleton{public: int get_data(); static Singleton* &get_ptr();public: int m_data; static Singleton *m_ptr;private: Singleton(){ m_data = 10;原创 2014-11-03 18:50:30 · 505 阅读 · 0 评论 -
杂七杂八
#include using namespace std;class TestClass{ friend ostream& operator<<(ostream&, TestClass&);public: TestClass(int *ptr) :p(ptr){} TestClass(const TestClass &value) : p(new int(*(value.p)))原创 2014-11-04 12:40:50 · 497 阅读 · 0 评论 -
乱七八糟
#include using namespace std;int main(){ //int *p = nullptr; ////const int *ptr = p; // OK ////const int* &pptr = p; // error: 无法用 "int *" 类型的值初始化 "const int *&" 类型的引用(非常量限定) ////int *const pt原创 2014-11-05 13:31:34 · 501 阅读 · 0 评论 -
c++ thread detach
#include <iostream>#include <thread>int main(){ for (int i = 0; i < 1; ++i) { std::thread([]() { std::cout << "thread" << std::endl; }).detach(); } f原创 2015-10-25 16:54:35 · 736 阅读 · 0 评论
分享