Map - finding nearest value?
问题 I am trying find nearest RGB value in QMap (I know it probably should be HSV, but that is not the problem). Here is what I got so far: it = images_map.find(current_rgb); if(it != images_map.begin()){ mi = images_map.lowerBound(current_rgb).value(); } else{ mi = images_map.upperBound(current_rgb).value(); } My map looks like this has that indexes: images_map[ 4283914078 ] images_map[ 4284046165 ] images_map[ 4284902241 ] images_map[ 4289239953 ] images_map[ 4282200377 ] images_map[ 4289440688