Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Using SV as key in hash

by Fletch (Bishop)
on Jul 17, 2006 at 01:41 UTC ( [id://561629]=note: print w/replies, xml ) Need Help??


in reply to Using SV as key in hash

Gratuitous handwaving here since it's been ages since I mucked with XS, but . . .

I want to say that the keys to an HV are always stringified and kept as char*, not as SV*s. A good starting place might be to look at what Tie::RefHash does and then implement something similar in your XS (possibly something like keeping your own internal mapping of char* to original SV*).

Replies are listed 'Best First'.
Re^2: Using SV as key in hash
by liz (Monsignor) on Jul 17, 2006 at 06:16 UTC
    I want to say that the keys to an HV are always stringified and kept as char*, not as SV*s.
    Well, that's just it. There is a provision in hv.c to actually have an SV as the key (rather than a char *). The HeSVKEY_set macro is supposed to be doing that.

    A good starting place might be to look at what Tie::RefHash does
    I'm afraid that Tie::RefHash doesn't have any XS component to obtain any inspiriation from ;-(

    Liz

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://561629]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2024-04-25 20:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found