随笔分类 - C/C++
摘要:用过三个c++ xll 项目 codeplex上一个xll项目 http://xll.codeplex.com/ 优点:项目很小巧,不依赖于其他package,比如boost等,下载后编译可直接使用。和excel数据以及函数接口可以满足基本需求。 缺点:就是因为项目只是提供了最基本的接口功能,如果想
阅读全文
摘要:http://www-f9.ijs.si/~ilija/slike/cs/aaa.pdf
阅读全文
摘要:int* getPtrToFive(){ int* x = new int; *x = 5; return &x; }void main(){ int* p = getPtrToFive(); cout<<*p<<endl; delete p; }从MIT 公开课的一个课件看到的。 如果在 getPtrToFive里面不用指针,只是让 x = 5; return &x 那么在main函数里面将无法返回5这个值,因为变量定义域的问题。
阅读全文
摘要:二维数组内存定义// allocationint** array = new int *[iSizeY]for( int j = 0; j < iSizeY; j++){ array[j] = new int [iSizeX];}// deallocationfor( int j = 0; j < iSizeY; j++){ delete [] array[j];}delete []array二维数组作为函数参数http://www.cnblogs.com/Anker/archive/2013/03/09/2951878.html
阅读全文
摘要:Heap is a large pool of memory used for dynamic allocation. When using new operator, to allocate the memory, the memory is assignedfrom heap.When a dynamically allocated variable is deleted, the memory is “returned” to the heap and can then be reassigned as future allocation requests are received.Th
阅读全文
摘要:网上找到的, 总结的比较细。 看了其中一部分,还不错http://www.cs.ucr.edu/~lyan/c++interviewquestions.pdf
阅读全文
摘要:explicit is a key word to prevent the constructor to do the implicit type conversionclass String1 {public: String1(int n); // assign n bytes}class String2 {public: explicit String2(int n); // assign n bytes}String1 str1 = 'x'; // OK: 'x' will be converted to int and calls the String1
阅读全文
摘要:A smart pointer is an abstract data type that stimulates a pointer with additional funationality, such as auto memory deallocation, reference counting, etc. In practise it could be a wrapper around of a regular pointer and forwards all meaningfull operations to the pointerThe simplest smart pointer
阅读全文
摘要:经常容易混淆的概念pointer to const -> 指向的数据不能被修改const pointer -> 指针的地址不能被修改int a = 3;int b = 4;// read from right to leftconst int * p1 = &a; // a pointer to a const intint * const p2 = &b; // a const pointer to an int*p1 = b; // not OKp1 = &b; // OKa = 4; // OK: *p1 = 4p2 = &a; // not
阅读全文
浙公网安备 33010602011771号