C++ implementation of linked-list data structures