From 58b14bab3cde4c0fc8febe7c10fcc64a95dc24f3 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 24 Mar 2006 14:14:29 +0000 Subject: Using NULL as a default value is not working in general (e.g. for Common::String) -- force explicit definition of a default value svn-id: r21424 --- common/assocarray.h | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'common') diff --git a/common/assocarray.h b/common/assocarray.h index d1032ebf2c..4fe4ae93a3 100644 --- a/common/assocarray.h +++ b/common/assocarray.h @@ -107,12 +107,13 @@ private: inline void expand_array(void); inline Val &subscript_helper(Key &index); // like [], but never expands array -public: inline int nele_val(void) const { return _nele; } - inline Val defaultValue_val(void) const { return _default_value; } + +public: inline Val &operator [](const Key &index); - inline AssocArray(Val default_value = NULL); +// inline AssocArray(Val default_value = Val()); + inline AssocArray(Val default_value); inline ~AssocArray(); inline int contains(const Key &index) const; inline Key *new_all_keys(void) const; @@ -198,19 +199,17 @@ inline Val *AssocArray ::new_all_values(void) const { template inline AssocArray ::AssocArray(Val default_value) : _default_value(default_value) { - int ctr; +// int ctr; _arr = new aa_ref_t *[INIT_SIZE]; - for (ctr = 0; ctr < INIT_SIZE; ctr++) - _arr[ctr] = NULL; +// for (ctr = 0; ctr < INIT_SIZE; ctr++) +// _arr[ctr] = NULL; - assert(_arr != NULL); +// assert(_arr != NULL); _arrsize = INIT_SIZE; _nele = 0; - - return; } template -- cgit v1.2.3