Hi Thomas,
thank you very much. As you see, Eddie solved the problem.
Best regards,
Marco.
Paine, Thomas Asa schrieb:
> Marco,
> What I found was that in hascode.hh there is now defined a hashcode
> signature for a Template type T, however, it is defined as such...
>
> template <typename T>
> inline size_t
> hashcode(const T &x)
> {
> return x.hashcode();
> }
>
> As a result the hashcode function is matching the signature of
> fucntion above. In your case you are passing in a T* (by reference, not that
> it really matters) So I think it we would need something like this to avoid
> your error...
>
> return x->hashcode();
>
> But of couse, simply changing this would break non pointer cases.
> I'm not sure the best way to work around this though, but I think it explains
> your error. I don't *know if you can define both a hashcode(const T &x) and
> a hashcode(const T* &x). I suppose you could always define a specific friend
> function to match your key type, like hashcode(const Packet* &x), but I'm not
> 100% sure.
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Thomas Paine [EMAIL PROTECTED])}
> University of Wisconsin - Eau Claire
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marco Wenzel
> Sent: Friday, October 05, 2007 9:56 AM
> To: [EMAIL PROTECTED]
> Subject: [Click] hastable/HashMap
>
> Hi,
>
> since I updated Click to the current git-sources (last version was from
> 2007-07-10), I've got a problem with the usage of HashTable.
> The code
>
>> dsttable->remove(packet);
>
> where dsttable is
>
>> typedef HashMap<Packet*, IPAddress*> DstMap;
>> DstMap* dsttable;
>
> and packet is a
>
>> WritablePacket * packet;
>
> causes thefollowing compile-error:
>
> ../include/click/hashcode.hh: In function 'size_t hashcode(const T&) [with T =
> Packet*]':
> ../include/click/hashmap.cc:510: instantiated from 'size_t HashMap<K,
> void*>::bucket(const K&) const [with K = Packet*]'
> ../include/click/hashmap.cc:609: instantiated from 'bool HashMap<K,
> void*>::remove(const K&) [with K = Packet*]'
> ../elements/local/myelement.cc:49: instantiated from here
> ../include/click/hashcode.hh:9: error: request for member 'hashcode' in 'x',
> which is of non-class type 'Packet* const'
>
> It worked correctly before and I don't know how to interpret this error.
> Sorry,
> if this question is too trivial, but if anyone could help me, I would be very
> glad. Thanks a lot.
>
> Regards,
> Marco.
_______________________________________________
click mailing list
[email protected]
https://amsterdam.lcs.mit.edu/mailman/listinfo/click