--- parser3/src/include/pa_hash.h 2001/05/17 09:21:55 1.40 +++ parser3/src/include/pa_hash.h 2001/09/07 11:05:02 1.43 @@ -5,14 +5,13 @@ Author: Alexander Petrosyan (http://design.ru/paf) - $Id: pa_hash.h,v 1.40 2001/05/17 09:21:55 parser Exp $ + $Id: pa_hash.h,v 1.43 2001/09/07 11:05:02 parser Exp $ */ #ifndef PA_HASH_H #define PA_HASH_H -#include - +#include "pa_config_includes.h" #include "pa_pool.h" #include "pa_types.h" #include "pa_string.h" @@ -33,12 +32,16 @@ public: typedef void (*For_each_func)(const Key& key, Val *value, void *info); /// first_that iterator function type - typedef bool (*First_that_func)(const Key& key, Val *value, void *info); + typedef void *(*First_that_func)(const Key& key, Val *value, void *info); public: Hash(Pool& apool) : Pooled(apool) { - construct(apool); + construct_new(); + } + + Hash(const Hash& source) : Pooled(source.pool()){ + construct_copy(source); } /// useful generic hash function @@ -82,14 +85,15 @@ public: void for_each(For_each_func func, void *info=0) const; /// iterate over all elements until condition - Val* first_that(First_that_func func, void *info=0) const; + void *first_that(First_that_func func, void *info=0) const; /// remove all elements void clear(); protected: - void construct(Pool& apool); + void construct_new(); + void construct_copy(const Hash& source); private: @@ -140,7 +144,6 @@ private: private: //disabled - //Hash(Hash&) {} Hash& operator = (const Hash&) { return *this; } };