[Insight-users] a question regarding itk::hash

kurt Zhao kurtzhao at yeah.net
Mon Jun 25 00:20:08 EDT 2007


Hi,

I am trying to use void* pointer as the type of the key in a itk::hash_map.

so

void main ( void )

{
itk::hash_map< void*,  int >  mash;
  void* tempP = NULL ;
  hash[ tempP ] = 2;
}

However, the MSVC .Net gave me the error listed below.

Any idea to use void* as the type of key in a hash_map?

Thanks a lot!

-Kurt

e:\work\insight\code\common\itk_hashtable.h(581) : error C2064: term
does not evaluate to a function taking 1 arguments
2>        e:\work\insight\code\common\itk_hashtable.h(580) : while
compiling class template member function
'itk::hashtable<Value,Key,HashFcn,ExtractKey,EqualKey,Alloc>::size_type
itk::hashtable<Value,Key,HashFcn,ExtractKey,EqualKey,Alloc>::bkt_num_key(void
*const &,size_t) const'
2>        with
2>        [
2>            Value=std::pair<void *const ,int>,
2>            Key=void *,
2>            HashFcn=itk::hash<void *>,
2>            ExtractKey=std::select1st<std::pair<void *const ,int>>,
2>            EqualKey=std::equal_to<void *>,
2>            Alloc=std::allocator<char>
2>        ]
2>        E:\work\Insight\Code\Common\itk_hash_map.h(120) : see
reference to class template instantiation
'itk::hashtable<Value,Key,HashFcn,ExtractKey,EqualKey,Alloc>' being
compiled
2>        with
2>        [
2>            Value=std::pair<void *const ,int>,
2>            Key=void *,
2>            HashFcn=itk::hash<void *>,
2>            ExtractKey=std::select1st<std::pair<void *const ,int>>,
2>            EqualKey=std::equal_to<void *>,
2>            Alloc=std::allocator<char>
2>        ]
2>        e:\work\nirl\roptool\RoPImage.h(343) : see reference to
class template instantiation 'itk::hash_map<Key,T>' being compiled
2>        with
2>        [
2>            Key=void *,
2>            T=int
2>        ]


More information about the Insight-users mailing list