mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-19 04:57:53 +00:00
Add entries() to go with keys() for future use.
This commit is contained in:
parent
da9a720c3f
commit
cfd101c9b8
@ -30,6 +30,8 @@
|
||||
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <algorithm>
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
@ -196,6 +198,24 @@ public:
|
||||
return k;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Vector of all entries (pairs of K,V)
|
||||
*/
|
||||
inline typename std::vector< std::pair<K,V> > entries()
|
||||
{
|
||||
typename std::vector< std::pair<K,V> > k;
|
||||
if (_s) {
|
||||
for(unsigned long i=0;i<_bc;++i) {
|
||||
_Bucket *b = _t[i];
|
||||
while (b) {
|
||||
k.push_back(std::pair<K,V>(b->k,b->v));
|
||||
b = b->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
return k;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param k Key
|
||||
* @return Pointer to value or NULL if not found
|
||||
|
Loading…
Reference in New Issue
Block a user