diff options
Diffstat (limited to '')
-rw-r--r-- | src/hash.h | 41 |
1 files changed, 41 insertions, 0 deletions
@@ -1148,6 +1148,47 @@ namespace Bu | |||
1148 | return lValues; | 1148 | return lValues; |
1149 | } | 1149 | } |
1150 | 1150 | ||
1151 | bool operator==( const MyType &rhs ) const | ||
1152 | { | ||
1153 | if( this == &rhs ) | ||
1154 | return true; | ||
1155 | if( core == rhs.core ) | ||
1156 | return true; | ||
1157 | if( core == NULL || rhs.core == NULL ) | ||
1158 | return false; | ||
1159 | if( getSize() != rhs.getSize() ) | ||
1160 | return false; | ||
1161 | |||
1162 | for( uint32_t j = 0; j < core->nCapacity; j++ ) | ||
1163 | { | ||
1164 | if( core->isFilled( j ) ) | ||
1165 | { | ||
1166 | if( !core->isDeleted( j ) ) | ||
1167 | { | ||
1168 | // Check to see if this key is in the other hash | ||
1169 | if( rhs.has( core->aKeys[j] ) ) | ||
1170 | { | ||
1171 | if( !(core->aValues[j] == rhs.get( core->aKeys[j]) ) ) | ||
1172 | { | ||
1173 | return false; | ||
1174 | } | ||
1175 | } | ||
1176 | else | ||
1177 | { | ||
1178 | return false; | ||
1179 | } | ||
1180 | } | ||
1181 | } | ||
1182 | } | ||
1183 | |||
1184 | return true; | ||
1185 | } | ||
1186 | |||
1187 | bool operator!=( const MyType &rhs ) const | ||
1188 | { | ||
1189 | return !(*this == rhs); | ||
1190 | } | ||
1191 | |||
1151 | protected: | 1192 | protected: |
1152 | virtual Core *_copyCore( Core *src ) | 1193 | virtual Core *_copyCore( Core *src ) |
1153 | { | 1194 | { |