What is the best way to use two keys with a std::map?

I have a std::map that I’m using to store values for x & y coordinates. My data is very sparse, so I don’t want to use arrays or vectors, which would result in a massive waste of memory. My data ranges from -250000 to 250000 but I’ll only have a few thousand points at the most.

Currently I’m creating a std::string with the two coordinates (ie “12×45”) and using it as a key. This doesn’t seem like the best way to do it.

My other thoughts were to use an int64 and shove the two int32s into it and use it as a key.

Or to use a class with the two coordinates. What are the requirements on a class that is to be used as the key?

What is the best way to do this? I’d rather not use a map of maps.

What is the best way to use two keys with a std::map?