Using a (mathematical) vector in a std::map
问题 Related: what can I use as std::map keys? I needed to create a mapping where specific key locations in space map to lists of objects. std::map seemed the way to do it. So I'm keying a std::map on an xyz Vector class Vector { float x,y,z } ; , and I'm making a std::map<Vector, std::vector<Object*> > . So note the key here is not a std::vector , its an object of class Vector which is just a math xyz vector of my own making. To produce a "strictly weak ordering" I've written the following