a simple cpp register utility