- 博客(15)
- 收藏
- 关注
原创 C/C++ Quiz: Exchange int a and int b without int temp
int a = 5;int b = 8;a = a^b;b = a^b;a = a^b;
2020-07-10 16:32:28 105
原创 DevTools - Doxygen Tutorial
Find latest Doxygenhttps://www.doxygen.nl/download.html
2020-06-05 16:12:44 121
原创 C/C++ Tips - cast
4 cast keywords in C++:const_cast static_cast dynamic_cast reinterpret_cast
2020-06-01 00:56:32 133
原创 C++ Tips - Smart Pointer
Smart pointers are defined in std namespace and <memory> header file.auto_ptr - no longer used in C++11 unique_ptr -Allows exactly one owner of the underlying pointer.Can be moved to a new owner, but not copied or shared. shared_ptr -Referenc...
2020-05-27 16:04:45 195
原创 Inside the C++ Object Model - 7. On the Cusp of the Object Model
1. Template// nullptr, no object is pointed to. Point<float> *ptr = 0;// it will instantiate a point instance// which will be converted to// Point<float> temp(float(0));// const Point<float> &ref = temp;const Point<float&g
2020-05-26 22:25:50 89
原创 Inside the C++ Object Model - 6. Runtime Semantics
It is not easy to predict the complexity of the function.
2020-05-26 21:57:56 114
原创 Inside the C++ Object Model - 5. Semantics of Construction, Destruction, and Copy
Abstract class cannot instantiate instance given pure virtual function exists.
2020-05-26 21:54:03 153
原创 Inside the C++ Object Model - 4. The Semantics of Function
Base2 *base2 = new Derived;// code will be converted to Derived *temp = new Derived;Base2 *base2 = temp ? temp + sizeof(base1) : 0;C++ critiaria - nonstatic member function has to perform no worse than nonmember function.Actually, compiler will e..
2020-05-26 00:35:32 94
原创 Inside the C++ Object Model - 3. The Semantics of Data
A char will be inserted into a class object if it is empty - 1 byte for an empty class object
2020-05-25 10:31:16 87
原创 Inside the C++ Object Model - 2. The Semantics of Contructors
Adefaultconstructorisaconstructorwhichcanbecalledwithnoarguments(eitherdefinedwithanemptyparameterlist,orwithdefaultargumentsprovidedforeveryparameter).Defaultconstuctoriscreatedbyuserorbycompilerwhenitisneeded....
2020-05-24 20:35:40 139
原创 Inside the C++ Object Model - 1. Object Lessons
C++ uses ADT(abstract data type)class Point3d{public: Point3d(float x=0.0,float y=0.0,float z=0.0):_x(x),_y(y),_z(z){} float x() {return _x;} float y() {return _y;} float z() {return _z;}private: float _x; float _y; float
2020-05-23 14:11:44 200
原创 General Sort Algorithm
1. Intersect Sortvoid IntersectSort(std::vector<int> &inVec){ int size = inVec.size(); for (int j = 1; j < size; ++j) { int key = inVec[j]; int i = j - 1; while (i >= 0 && key < inVec...
2020-05-21 20:40:42 111
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人