cpp implementation of dictionary