ensure that critical variables have been initialize
Minor change:

(std::list::size() == 0) <==> std::list::empty()
Prefer prefix (++) operators for non-primitive types
remove not used variable
remove useless trailing whitespace at the end of files