Probably std::string. It has built-in content comparison operators. (In other words, it does strcmp() for you.)

Whereas if you use char*, you compare by pointer address value. The same string contents can exist at multiple addresses, so you can end up with duplicate entries for the same string content.

EDIT: Actually, you can use char* correctly in std::map, but you have to supply a comparison functor:
https://stackoverflow.com/questions/4157687/using-char-as-a-key-in-stdmap/4157729#4157729

Also, you would still have to guarantee that the pointers are valid. At least with std::string, each string maintains its own copy of its full string. For that reason, you'd still be safer with std::string. (There are more optimized implementations available, but I will not discuss that here.)

Last edited by AndrewAMD; 09/23/20 15:24.