C++ adaptation