summaryrefslogtreecommitdiff
path: root/node/Hashtable.hpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2015-09-04 12:14:21 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2015-09-04 12:14:21 -0700
commit3a959a7763b44ffcddce557167169150a28b9059 (patch)
treeb2e07eba02cdd1716ba21cae14224e8fefa4d1b4 /node/Hashtable.hpp
parentcfd101c9b85b20e5911445998a6f040089e3e414 (diff)
downloadinfinitytier-3a959a7763b44ffcddce557167169150a28b9059.tar.gz
infinitytier-3a959a7763b44ffcddce557167169150a28b9059.zip
Swap out std::map<> for Hashtable<> for main peer database in Topology. (ongoing std::map-ectomy)
Diffstat (limited to 'node/Hashtable.hpp')
-rw-r--r--node/Hashtable.hpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/node/Hashtable.hpp b/node/Hashtable.hpp
index 6f7541c4..84b5be0e 100644
--- a/node/Hashtable.hpp
+++ b/node/Hashtable.hpp
@@ -183,10 +183,11 @@ public:
/**
* @return Vector of all keys
*/
- inline typename std::vector<K> keys()
+ inline typename std::vector<K> keys() const
{
typename std::vector<K> k;
if (_s) {
+ k.reserve(_s);
for(unsigned long i=0;i<_bc;++i) {
_Bucket *b = _t[i];
while (b) {
@@ -201,10 +202,11 @@ public:
/**
* @return Vector of all entries (pairs of K,V)
*/
- inline typename std::vector< std::pair<K,V> > entries()
+ inline typename std::vector< std::pair<K,V> > entries() const
{
typename std::vector< std::pair<K,V> > k;
if (_s) {
+ k.reserve(_s);
for(unsigned long i=0;i<_bc;++i) {
_Bucket *b = _t[i];
while (b) {