上一页 1 ··· 4 5 6 7 8
摘要: #include <iostream>using namespace std;template <class T>struct plus{ T operator()(const T& x, const T& y) const { return x + y; }};template <class T>struct minus{ T operator()(const T& x, const T& y) const { return x - y; }};int main(){ plus<int> plusobj; min 阅读全文
posted @ 2012-08-31 15:36 lichongbin 阅读(134) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <new>using namespace std;const int chunk = 16;class Foo{public: int val() { return __val; } Foo() { __val = 0; }private: int __val;};char *buf = new char[sizeof(Foo) * chunk];int main(int argc, char* argv[]){ Foo *pb = new (buf)Foo; if (pb->val() ... 阅读全文
posted @ 2012-08-30 15:50 lichongbin 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 对于动态分配常量对象,我平时写代码从来没有用过。今天看C++书时注意到了。在VC6.0里测试了一下,结果VC6.0不支持。const int *pic = new const int(1000);注意:1、常量对象的动态分配和普通变量一样,可以动态释放。2、常量对象只能是基本数据类型,并在分配时,必须赋值。 阅读全文
posted @ 2012-08-29 15:46 lichongbin 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 函数原型:BOOL WINAPI PostThreadMessage(_In_DWORD idThread,_In_UINT Msg,_In_WPARAM wParam,_In_LPARAM lParam);idThread - [in] Type: DWORD The identifier of the thread to which the message is to be posted.Msg - [in] Type: UINT The type of message to be posted.wParam - [in] Type: WPARAM Additional message-. 阅读全文
posted @ 2012-08-24 16:45 lichongbin 阅读(580) 评论(0) 推荐(0) 编辑
摘要: The most beautiful formula in mathematics:e,j,PI,1,0仅出现一次。幂运算、乘、加、等于仅出现一次。 阅读全文
posted @ 2012-07-28 10:09 lichongbin 阅读(276) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8