Nevelex Corporation Nevelex Utilities 1.1.4 09/06/2003
Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

PointerHash.h

00001 
00031 /***************************************************************************
00032         PointerHash.h  -  Functor class to use as the hash function for
00033                 templates that use pointers.
00034                              -------------------
00035         Author:         Michel Dalal
00036         Date:           Wed Sep 25 2002
00037         Copyright:      (C) 2002 Nevelex Corporation
00038  ***************************************************************************/
00039 
00040 #ifndef POINTERHASH_H
00041 #define POINTERHASH_H
00042 
00043 #ifdef _DEBUG_LOWLEVEL
00044 #include <stdio.h>
00045 #endif
00046 
00054 namespace nevelex_util
00055 {
00064         template<class T>
00065         class PointerHash
00066         {
00067         public:
00075                 size_t operator()(T const& key) const
00076                 {
00077 #ifdef _DEBUG_LOWLEVEL
00078                         printf("DEBUG: PointerHash hash = %p\n",key);
00079 #endif
00080                         return (size_t)key;
00081                 }
00082         };
00083 }       // namespace nevelex_util
00084 #endif