summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-12-22 16:50:54 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2017-12-29 13:05:59 +0100
commit65c444d2d5a33c78822590b97279aeb9cd2ef0f7 (patch)
tree046cad9f6769f8d6272b971f303f391fc6bca961
parent7a987cefe8df0f1750dd82fc6ae719f4ccdd3569 (diff)
Ensure methods are inlined.
-rw-r--r--eval/src/vespa/eval/tensor/sparse/sparse_tensor_address_builder.h6
-rw-r--r--vespalib/src/vespa/vespalib/stllike/hash_map.h2
-rw-r--r--vespalib/src/vespa/vespalib/stllike/hash_map.hpp8
3 files changed, 7 insertions, 9 deletions
diff --git a/eval/src/vespa/eval/tensor/sparse/sparse_tensor_address_builder.h b/eval/src/vespa/eval/tensor/sparse/sparse_tensor_address_builder.h
index 4254e13aa16..f74ce257b31 100644
--- a/eval/src/vespa/eval/tensor/sparse/sparse_tensor_address_builder.h
+++ b/eval/src/vespa/eval/tensor/sparse/sparse_tensor_address_builder.h
@@ -26,7 +26,11 @@ protected:
_address.push_back_fast(str[i]);
}
}
- void ensure_room(size_t additional) { _address.reserve(_address.size() + additional); }
+ void ensure_room(size_t additional) {
+ if (_address.capacity() < (_address.size() + additional)) {
+ _address.reserve(_address.size() + additional);
+ }
+ }
public:
SparseTensorAddressBuilder() : _address() {}
void add(vespalib::stringref label) {
diff --git a/vespalib/src/vespa/vespalib/stllike/hash_map.h b/vespalib/src/vespa/vespalib/stllike/hash_map.h
index 31185a9ff7c..023594d3018 100644
--- a/vespalib/src/vespa/vespalib/stllike/hash_map.h
+++ b/vespalib/src/vespa/vespalib/stllike/hash_map.h
@@ -35,7 +35,7 @@ public:
size_t capacity() const { return _ht.capacity(); }
size_t size() const { return _ht.size(); }
bool empty() const { return _ht.empty(); }
- insert_result insert(const value_type & value);
+ insert_result insert(const value_type & value) { return _ht.insert(value); }
template <typename InputIt>
void insert(InputIt first, InputIt last);
const V & operator [] (const K & key) const { return _ht.find(key)->second; }
diff --git a/vespalib/src/vespa/vespalib/stllike/hash_map.hpp b/vespalib/src/vespa/vespalib/stllike/hash_map.hpp
index 40ef90826b6..e78d6263fb2 100644
--- a/vespalib/src/vespa/vespalib/stllike/hash_map.hpp
+++ b/vespalib/src/vespa/vespalib/stllike/hash_map.hpp
@@ -17,13 +17,7 @@ hash_map<K, V, H, EQ, M>::hash_map(size_t reserveSize, H hasher, EQ equality) :
{ }
template <typename K, typename V, typename H, typename EQ, typename M>
-hash_map<K, V, H, EQ, M>::~hash_map() { }
-
-template <typename K, typename V, typename H, typename EQ, typename M>
-typename hash_map<K, V, H, EQ, M>::insert_result
-hash_map<K, V, H, EQ, M>::insert(const value_type & value) {
- return _ht.insert(value);
-}
+hash_map<K, V, H, EQ, M>::~hash_map() = default;
template <typename K, typename V, typename H, typename EQ, typename M>
void