Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualEWClay

Posted 03 February 2013 - 06:07 AM

Yes, a single unordered map should be fine. If you want to be sure to avoid hash collisions (which may happen with the above example), you can define a hash for the struct, typically XORing the three numbers together, and use the struct itself as the key.

Non-linear performance, by the way, would probably indicate a poor hash. In that case, try std::hash on the integers first.

#1EWClay

Posted 03 February 2013 - 05:32 AM

Yes, a single unordered map should be fine. If you want to be sure to avoid hash collisions (which may happen with the above example), you can define a hash for the struct, typically XORing the three numbers together, and use the struct itself as the key.

PARTNERS