From 7941771d617a7df14319ade31ed30c69af27c2af Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 23 Apr 2017 10:09:18 +0100 Subject: [PATCH] Expand calls to at implementation --- .../boost/unordered/detail/implementation.hpp | 14 -------------- include/boost/unordered/unordered_map.hpp | 18 ++++++++++++++++-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index 599ec1c7..afbfb2a2 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -3759,20 +3759,6 @@ struct table_unique : boost::unordered::detail::table } } - // Accessors - - value_type& at(const_key_type& k) const - { - if (this->size_) { - node_pointer n = this->find_node(k); - if (n) - return n->value(); - } - - boost::throw_exception( - std::out_of_range("Unable to find key in unordered_map.")); - } - // equals bool equals(table_unique const& other) const diff --git a/include/boost/unordered/unordered_map.hpp b/include/boost/unordered/unordered_map.hpp index 8deca06d..a55e2b5c 100644 --- a/include/boost/unordered/unordered_map.hpp +++ b/include/boost/unordered/unordered_map.hpp @@ -1723,14 +1723,28 @@ template typename unordered_map::mapped_type& unordered_map::at(const key_type& k) { - return table_.at(k).second; + if (table_.size_) { + node_pointer n = table_.find_node(k); + if (n) + return n->value().second; + } + + boost::throw_exception( + std::out_of_range("Unable to find key in unordered_map.")); } template typename unordered_map::mapped_type const& unordered_map::at(const key_type& k) const { - return table_.at(k).second; + if (table_.size_) { + node_pointer n = table_.find_node(k); + if (n) + return n->value().second; + } + + boost::throw_exception( + std::out_of_range("Unable to find key in unordered_map.")); } template