data structure implementation in C++