--- parser3/src/include/pa_hash.h 2001/08/06 16:18:26 1.42 +++ parser3/src/include/pa_hash.h 2001/10/05 08:20:26 1.44 @@ -5,7 +5,7 @@ Author: Alexander Petrosyan (http://design.ru/paf) - $Id: pa_hash.h,v 1.42 2001/08/06 16:18:26 parser Exp $ + $Id: pa_hash.h,v 1.44 2001/10/05 08:20:26 parser Exp $ */ #ifndef PA_HASH_H @@ -37,7 +37,11 @@ public: public: Hash(Pool& apool) : Pooled(apool) { - construct(apool); + construct_new(); + } + + Hash(const Hash& source) : Pooled(source.pool()){ + construct_copy(source); } /// useful generic hash function @@ -75,7 +79,7 @@ public: //@} /// number of elements in hash - int size() const { return used; } + int size() const { return count; } /// iterate over all not zero elements void for_each(For_each_func func, void *info=0) const; @@ -88,7 +92,8 @@ public: protected: - void construct(Pool& apool); + void construct_new(); + void construct_copy(const Hash& source); private: @@ -113,6 +118,9 @@ private: /// used pairs int used; + /// stored pairs total (including those by links) + int count; + /// pair storage class Pair { friend Hash; @@ -139,7 +147,6 @@ private: private: //disabled - //Hash(Hash&) {} Hash& operator = (const Hash&) { return *this; } };