diff --git a/include/cista/type_hash/static_type_hash.h b/include/cista/type_hash/static_type_hash.h index b21d9415..d2a4ade7 100644 --- a/include/cista/type_hash/static_type_hash.h +++ b/include/cista/type_hash/static_type_hash.h @@ -31,12 +31,11 @@ struct count_map { key_type first; mapped_type second; }; - using iterator = typename std::array::iterator; using const_iterator = typename std::array::const_iterator; constexpr count_map() = default; - constexpr std::pair add(key_type k) { + constexpr std::pair add(key_type k) noexcept { auto const it = find(k); if (it == end()) { arr_[size_] = value_type{k, static_cast(size_)}; @@ -48,7 +47,7 @@ struct count_map { } } - constexpr const_iterator find(key_type k) const { + constexpr const_iterator find(key_type k) const noexcept { for (auto it = begin(); it != end(); ++it) { if (it->first == k) { return it; @@ -57,8 +56,8 @@ struct count_map { return end(); } - constexpr const_iterator begin() const { return std::begin(arr_); } - constexpr const_iterator end() const { + constexpr const_iterator begin() const noexcept { return std::begin(arr_); } + constexpr const_iterator end() const noexcept { return std::next( begin(), static_cast< @@ -72,7 +71,7 @@ struct count_map { template struct hash_data { - constexpr hash_data combine(hash_t const h) const { + constexpr hash_data combine(hash_t const h) const noexcept { hash_data r; r.done_ = done_; r.h_ = hash_combine(h_, h); @@ -92,14 +91,14 @@ constexpr hash_data static_type_hash(T const*, hash_data) noexcept; template -constexpr auto hash_tuple_element(hash_data const h) { +constexpr auto hash_tuple_element(hash_data const h) noexcept { using element_type = std::decay_t>; return static_type_hash(null(), h); } template constexpr auto hash_tuple(Tuple const*, hash_data h, - std::index_sequence) { + std::index_sequence) noexcept { (hash_tuple_element(h), ...); return h; } @@ -155,7 +154,8 @@ constexpr auto static_type_hash(std::chrono::time_point const*, } template -constexpr auto static_type_hash(array const*, hash_data h) { +constexpr auto static_type_hash(array const*, + hash_data h) noexcept { h = static_type_hash(null(), h); return h.combine(hash("array")).combine(Size); }