Hello all,
I have a struct of four doubles and I want to use it as a key to std::map
How do I write the comparing function. I know I have to be careful about comparing doubles. Can somebody please help me. Before this I have only use std::map with simple types.Code:struct MatPropVals { double ambient; double diffuse; double specular; double emission; }
I don't want to insert a new MatPropVals object if it has already been inserted with all the four double values being equal. std::map will take care of this. But how do I write the comparing function.
I know that there is a FAQ about comparing doubles (epsilon thing). Does it apply in my case as well. I will take care of this but just need help on the comparing function.
Thanks in advance![]()




Reply With Quote