From 4e55dab4511ffa8307e3ae7523659e6087632f95 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 21 Nov 2006 19:22:12 +0000 Subject: Added a has function to Hash --- src/hash.h | 9 +++++++++ src/tests/hash.cpp | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/hash.h b/src/hash.h index 6fdf8e1..b5bf8d6 100644 --- a/src/hash.h +++ b/src/hash.h @@ -215,6 +215,15 @@ public: } } + bool has( key k ) + { + uint32_t hash = __calcHashCode( k ); + bool bFill; + uint32_t nPos = probe( hash, k, bFill ); + + return bFill; + } + typedef struct iterator { friend class Hash; diff --git a/src/tests/hash.cpp b/src/tests/hash.cpp index f9a8f12..a7f0a57 100644 --- a/src/tests/hash.cpp +++ b/src/tests/hash.cpp @@ -80,7 +80,7 @@ int main() for( int j = 0; j < 33; j++ ) { - if( sTest[names[j]].isFilled() ) + if( sTest.has(names[j]) ) { if( sTest[names[j]] != j ) { -- cgit v1.2.3