上一页 1 2 3 4 5 6 7 8 9 10 ··· 24 下一页
摘要: #include // overloading "operator = " outside class // 是二元操作符 ////////////////////////////////////////////////////////// class Rectangle { public: Rectangle(int w, int h) : width(w), height(... 阅读全文
posted @ 2019-12-01 10:01 路边的十元钱硬币 阅读(4032) 评论(0) 推荐(0) 编辑
摘要: #include // overloading "operator = " inside class // = 是一元操作符。不写,编译器会提供 默认 拷贝赋值函数。可以通过显式“=delete”来禁用默认。对于复杂class的默认=可能会造成问题,请特别注意。 ////////////////////////////////////////////////////////// clas... 阅读全文
posted @ 2019-12-01 09:44 路边的十元钱硬币 阅读(499) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> // overloading "operator == " outside class // == 是二元操作符 ////////////////////////////////////////////////////////// class Rectangle { public: Rectangle(int w, int h) : width(w), he 阅读全文
posted @ 2019-12-01 09:29 路边的十元钱硬币 阅读(323) 评论(0) 推荐(0) 编辑
摘要: #include // overloading "operator == " inside class // == 是二元操作符 ////////////////////////////////////////////////////////// class Rectangle { public: Rectangle(int w, int h) : width(w), heig... 阅读全文
posted @ 2019-12-01 09:25 路边的十元钱硬币 阅读(1144) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <thread> #include <mutex> #include <Windows.h> // callback test ///////////////////////////////////////////////////////////// // API part typedef void(__stdcall *CallbackE 阅读全文
posted @ 2019-11-25 15:40 路边的十元钱硬币 阅读(715) 评论(0) 推荐(0) 编辑
摘要: // traits 的应用 /////////////////////////////////////////// // traits template <typename T> class sigmaTraits {}; // 特化 template <> class sigmaTraits<char> { public: typedef int returnType; }; template 阅读全文
posted @ 2019-11-24 19:27 路边的十元钱硬币 阅读(168) 评论(0) 推荐(0) 编辑
摘要: const 修饰的成员函数 表示 不会修改class中的成员变量。 const 和 非-const 的成员函数同事存在时, 用户定义 const 类对象,调用 const 成员函数; 定义 非-const 类对象,调用 非-const 成员函数。 加上 const 的理由: 比如 string 中的 阅读全文
posted @ 2019-11-24 12:08 路边的十元钱硬币 阅读(867) 评论(0) 推荐(0) 编辑
摘要: #include // 偏特化的模板不会自己添加构造函数 ctor 和 析构函数 dtor #if 1 // P1 template class Stack { public: Stack() { std::cout class Stack { public: Stack() { std::cout class Stack { public: Stack() { std::... 阅读全文
posted @ 2019-11-24 12:02 路边的十元钱硬币 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 参见:https://en.cppreference.com/w/cpp/algorithm/find 查找指定字符/数字等。 阅读全文
posted @ 2019-09-18 23:00 路边的十元钱硬币 阅读(2965) 评论(0) 推荐(0) 编辑
摘要: 参见:https://en.cppreference.com/w/cpp/algorithm/find std::npos 表示 size_t 的最大值,常用于对查找结果成功与否的判断。 阅读全文
posted @ 2019-09-18 22:59 路边的十元钱硬币 阅读(1498) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 10 ··· 24 下一页