Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions include/pybind11/detail/internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ inline bool same_type(const std::type_info &lhs, const std::type_info &rhs) {
}

struct type_hash {
size_t operator()(const std::type_index &t) const {
size_t operator()(const std::type_index &t) const noexcept {
size_t hash = 5381;
const char *ptr = t.name();
while (auto c = static_cast<unsigned char>(*ptr++)) {
Expand All @@ -170,7 +170,7 @@ struct type_hash {
};

struct type_equal_to {
bool operator()(const std::type_index &lhs, const std::type_index &rhs) const {
bool operator()(const std::type_index &lhs, const std::type_index &rhs) const noexcept {
return lhs.name() == rhs.name() || std::strcmp(lhs.name(), rhs.name()) == 0;
}
};
Expand All @@ -186,7 +186,7 @@ template <typename value_type>
using type_map = std::unordered_map<std::type_index, value_type, type_hash, type_equal_to>;

struct override_hash {
size_t operator()(const std::pair<const PyObject *, const char *> &v) const {
size_t operator()(const std::pair<const PyObject *, const char *> &v) const noexcept {
size_t value = std::hash<const void *>()(v.first);
value ^= std::hash<const void *>()(v.second) + 0x9e3779b9 + (value << 6) + (value >> 2);
return value;
Expand Down
Loading