STL之hashtable
template<class Value> struct __hashtable_node { __hashtable_node *next; Value val; };
template<class Value, class Key>
struct __hashtable_iterator
{
typedef __hashtable_node<Value> node;
typedef hashtable<Value, Key> hashtable;
node *cur;
hashtable *ht;
__hashtable_iterator(node *n, hashtable *tab): cur(n), ht(tab){}
__hashtable_iterator(){}
reference operator*() const{ return cur->val;}
};
template<class Value, class Key>
class hashtable
{
private:
vector<node*> buckets;
size_type num_elements;
};

浙公网安备 33010602011771号