diff options
author | Max Horn | 2006-03-24 14:14:29 +0000 |
---|---|---|
committer | Max Horn | 2006-03-24 14:14:29 +0000 |
commit | 58b14bab3cde4c0fc8febe7c10fcc64a95dc24f3 (patch) | |
tree | adceda197a6a8911f298ccfa64e5d4f93b1048e8 | |
parent | 3e1afa4a2f5e7920782647d690d6108021b98719 (diff) | |
download | scummvm-rg350-58b14bab3cde4c0fc8febe7c10fcc64a95dc24f3.tar.gz scummvm-rg350-58b14bab3cde4c0fc8febe7c10fcc64a95dc24f3.tar.bz2 scummvm-rg350-58b14bab3cde4c0fc8febe7c10fcc64a95dc24f3.zip |
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
-rw-r--r-- | common/assocarray.h | 17 |
1 files changed, 8 insertions, 9 deletions
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 <Key, Val>::new_all_values(void) const { template <class Key, class Val> inline AssocArray <Key, Val>::AssocArray(Val default_value) : _default_value(default_value) { - int ctr; +// int ctr; _arr = new aa_ref_t <Key, Val> *[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 <class Key, class Val> |