From dfaa61b6666f0860c54aeefbc7bcf3a82c1d27f3 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 9 May 2010 07:24:47 +0000 Subject: [PATCH] Another inline. [SVN r61872] --- include/boost/unordered/detail/fwd.hpp | 24 ++++++++++++++++++++--- include/boost/unordered/detail/node.hpp | 6 ------ include/boost/unordered/detail/table.hpp | 17 ---------------- include/boost/unordered/detail/unique.hpp | 2 +- 4 files changed, 22 insertions(+), 27 deletions(-) diff --git a/include/boost/unordered/detail/fwd.hpp b/include/boost/unordered/detail/fwd.hpp index be4d5e1a..4adeb592 100644 --- a/include/boost/unordered/detail/fwd.hpp +++ b/include/boost/unordered/detail/fwd.hpp @@ -58,6 +58,12 @@ #endif +#if BOOST_WORKAROUND(__BORLANDC__, <= 0X0582) +#define BOOST_UNORDERED_BORLAND_BOOL(x) (bool)(x) +#else +#define BOOST_UNORDERED_BORLAND_BOOL(x) x +#endif + namespace boost { namespace unordered_detail { static const float minimum_max_load_factor = 1e-3f; @@ -469,13 +475,25 @@ namespace boost { namespace unordered_detail { return extractor::extract(node::get_value(n)); } bool equal(key_type const& k, value_type const& v) const; + template - node_ptr find_iterator(bucket_ptr bucket, Key const& k, - Pred const&) const; + inline node_ptr find_iterator(bucket_ptr bucket, Key const& k, + Pred const& eq) const + { + node_ptr it = bucket->next_; + while (BOOST_UNORDERED_BORLAND_BOOL(it) && + !eq(k, get_key(node::get_value(it)))) + { + it = node::next_group(it); + } + + return it; + } + node_ptr find_iterator(bucket_ptr bucket, key_type const& k) const; node_ptr find_iterator(key_type const& k) const; node_ptr* find_for_erase(bucket_ptr bucket, key_type const& k) const; - + // Load methods std::size_t max_size() const; diff --git a/include/boost/unordered/detail/node.hpp b/include/boost/unordered/detail/node.hpp index 85a31410..c2553bef 100644 --- a/include/boost/unordered/detail/node.hpp +++ b/include/boost/unordered/detail/node.hpp @@ -16,12 +16,6 @@ #include #include -#if BOOST_WORKAROUND(__BORLANDC__, <= 0X0582) -#define BOOST_UNORDERED_BORLAND_BOOL(x) (bool)(x) -#else -#define BOOST_UNORDERED_BORLAND_BOOL(x) x -#endif - namespace boost { namespace unordered_detail { //////////////////////////////////////////////////////////////////////////// diff --git a/include/boost/unordered/detail/table.hpp b/include/boost/unordered/detail/table.hpp index d37c0155..fca6113d 100644 --- a/include/boost/unordered/detail/table.hpp +++ b/include/boost/unordered/detail/table.hpp @@ -29,23 +29,6 @@ namespace boost { namespace unordered_detail { return this->key_eq()(k, get_key(v)); } - // strong exception safety, no side effects - template - template - inline BOOST_DEDUCED_TYPENAME T::node_ptr - hash_table::find_iterator(bucket_ptr bucket, Key const& k, - Pred const& eq) const - { - node_ptr it = bucket->next_; - while (BOOST_UNORDERED_BORLAND_BOOL(it) && - !eq(k, get_key(node::get_value(it)))) - { - it = node::next_group(it); - } - - return it; - } - // strong exception safety, no side effects template inline BOOST_DEDUCED_TYPENAME T::node_ptr diff --git a/include/boost/unordered/detail/unique.hpp b/include/boost/unordered/detail/unique.hpp index c57714f0..19fe7de8 100644 --- a/include/boost/unordered/detail/unique.hpp +++ b/include/boost/unordered/detail/unique.hpp @@ -248,7 +248,7 @@ namespace boost { namespace unordered_detail { // strong otherwise template - emplace_return hash_unique_table::emplace(Args&&... args) + emplace_return emplace(Args&&... args) { return this->size_ ? emplace_impl(