add cxx11 support

- fix compile errors when compiling with -std=c++11
- use atomic int for referenced data (no memory overhead + faster)
- use templated new's for SGMatrix(-List)