• Xiao Shi's avatar
    mark numerical hasher(s) noexcept · b61b327d
    Xiao Shi authored
    Summary:
    The libstdc++ implementation of `std::unordered_map|set` determines whether to
    cache a per-node hash code based on (1) whether the supplied hasher is fast
    (true by default) and (2) whether the hashing operation will throw.
    
    Mark the `operator()` of hashers of numeric types (integral, float, enum)
    `noexcept`, such that stl unordered containers won't cache a hash code. This is
    essentially free memomy savings, as comparing the cached hash code is as
    expensive as comparing the numerical types directly.
    
    Reviewed By: luciang
    
    Differential Revision: D7784214
    
    fbshipit-source-id: 020e1c38265f33a482b6ba913a11f1a383e840f8
    b61b327d
Hash.h 19.1 KB