Ben Chuanlong Du's Blog

It is never too late to learn.

Tips on C++

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

IDE

  1. Eclispe CDT is a good IDE for C/C++ development in Unix/Linux sytem. Configuration of Eclipse CDT in Windows system is not pleasant. Netbeans and code::blocks are good …

Tips on C++ Compilers

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

GCC

  1. User option -lpthread to link the thread library when your code use the thread library. If you do not use, the option -lpthread, you can probably compile your coe without …

Easy-Made Mistake with C++ Iterator

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

the wrong way

for(auto it=l.cbegin(); it!=l.cend(); ++it){
    for(auto jt=++it; jt!=l.cend(); ++jt){
        cout << *it << " <-> " << *jt << endl;
    }
}

it is increased again in the inner …

Sorting Functions in C++

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

std::sort std::stable_sort std::partial_sort

Notice that only std::stable_sort is stable sort (at the cost of additional time/space complexity). It is easy to achive stable sort using std …