added c++ version of 1.1