Add entries() to go with keys() for future use.
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user