C++ implement data structure