Skip to content

Commit

Permalink
Added noexcept specifier to hash functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhilkinSerg committed Dec 3, 2019
1 parent af5b035 commit ea5546d
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/active_item_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace std
{
template <>
struct hash<special_item_type> {
std::size_t operator()( const special_item_type &k ) const {
std::size_t operator()( const special_item_type &k ) const noexcept {
return static_cast<size_t>( k );
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/color.h
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ namespace std
{
template<>
struct hash<nc_color> {
std::size_t operator()( const nc_color &v ) const {
std::size_t operator()( const nc_color &v ) const noexcept {
return hash<int>()( v.operator int() );
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/int_id.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ namespace std
{
template<typename T>
struct hash< int_id<T> > {
std::size_t operator()( const int_id<T> &v ) const {
std::size_t operator()( const int_id<T> &v ) const noexcept {
return hash<int>()( v.to_i() );
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/point.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ namespace std
{
template <>
struct hash<point> {
std::size_t operator()( const point &k ) const {
std::size_t operator()( const point &k ) const noexcept {
constexpr uint64_t a = 2862933555777941757;
size_t result = k.y;
result *= a;
Expand All @@ -334,7 +334,7 @@ namespace std
{
template <>
struct hash<tripoint> {
std::size_t operator()( const tripoint &k ) const {
std::size_t operator()( const tripoint &k ) const noexcept {
constexpr uint64_t a = 2862933555777941757;
size_t result = k.z;
result *= a;
Expand Down
2 changes: 1 addition & 1 deletion src/savegame_legacy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace std
template <>
struct hash<talk_topic_enum> {
// Operator overload required by std API.
std::size_t operator()( const talk_topic_enum &k ) const {
std::size_t operator()( const talk_topic_enum &k ) const noexcept {
return k; // the most trivial hash of them all
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/string_id.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ namespace std
{
template<typename T>
struct hash< string_id<T> > {
std::size_t operator()( const string_id<T> &v ) const {
std::size_t operator()( const string_id<T> &v ) const noexcept {
return hash<std::string>()( v.str() );
}
};
Expand Down

0 comments on commit ea5546d

Please sign in to comment.