mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-05 20:13:44 +02:00
Add entries() to go with keys() for future use.
This commit is contained in:
parent
da9a720c3f
commit
cfd101c9b8
1 changed files with 20 additions and 0 deletions
|
@ -30,6 +30,8 @@
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <utility>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
namespace ZeroTier {
|
namespace ZeroTier {
|
||||||
|
|
||||||
|
@ -196,6 +198,24 @@ public:
|
||||||
return k;
|
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
|
* @param k Key
|
||||||
* @return Pointer to value or NULL if not found
|
* @return Pointer to value or NULL if not found
|
||||||
|
|
Loading…
Add table
Reference in a new issue