c++0x migration and Backport Jpsi producer from 7_X_Y

C++0x foreach and auto statement migration
Backport of Jpsi producer from 7_X_Y branch is also incuded