Any type can work as a key in map as long as it has the proper operator overloads. IIRC, you need to have == and < overloaded. I don't believe std::pair has these overloaded, so if you want to use it as a key you'll have to make your own overloads.
HOWEVER, you should not be using a floating point for any part of a key in any map -- for the same reason you shouldn't use them with == and != operators. Since floating points are approximations, they are unreliable as keys.
Therefore pair<double,int> will fail horribly as a key, even if you got it to compile.
To be able to write mymap[x][y] you have to create a map that maps to a map. map<double, map<int,double>> mymap; This will probably be less efficient but it does what you want.
technically my key doubles are whole numbers, but I use them only because I use them in pow() functions later and they give me all sorts of trouble when I use ints. Doubles work, no headache, that's all I care about right now.
But is a double for loop the best way to check for the existence of x and y?
Double for loop? No that sounds like a very bad idea. In Lynx876 I assume myMap is a 2D array and not an std::map which only make sense if the key values are not far in between. The for loops is used to print all values in the map.
I've never used maps, not sure how they work. But the question was written:
Check if mymap[x][y] exists, and if so, return corresponding specificValue. If not, insert the specificValue under x,y in the map.
So would I be right in saying that the "check", to see if a value is existant if( myMap[ i ][ j ] ), assuming they are all NULL to begin with, then entering values, work?
If so, you can then use that if statement to input something in to the index you are on.
I don't know if it HAS to be mymap[x][y] specifically, as I am somewhat new-ish to C++
All I want is to toss in x and y to mymap somehow and have it kick back specificValue if the combination x and y exist together as the keys, and if not, insert specificValue.
As I said above, operator[] always returns a value, whatever key you use. So if you only want to find the values you actually set, you have to use the find approach.
For a map that stores doubles, mymap[make_pair(x,y)] will return 0.0 for all values of x,y that do not already have a value, creating new map entries as required.