www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - how does one address the char[] hash() method?

reply "Kris" <someidiot earthlink.dot.dot.dot.net> writes:
I thought this the appropriate incantation, but it produces an Access
Violation:

    uint hash = typeid(char[]).getHash (myCharArray);

- Kris
Jul 04 2004
next sibling parent reply "Walter" <newshound digitalmars.com> writes:
Put an & in front of myCharArray.

"Kris" <someidiot earthlink.dot.dot.dot.net> wrote in message
news:ccaj0b$7eh$1 digitaldaemon.com...
 I thought this the appropriate incantation, but it produces an Access
 Violation:

     uint hash = typeid(char[]).getHash (myCharArray);

 - Kris
Jul 05 2004
parent "Kris" <someidiot earthlink.dot.dot.dot.net> writes:
Thank you Walter;

It's non-intuitive, and contrary to typical array=>void * conversion
mechanics. But it does work, and that's good enough for me right now <g>

- Kris

"Walter" <newshound digitalmars.com> wrote in message
news:ccc0pk$2ku9$1 digitaldaemon.com...
 Put an & in front of myCharArray.

 "Kris" <someidiot earthlink.dot.dot.dot.net> wrote in message
 news:ccaj0b$7eh$1 digitaldaemon.com...
 I thought this the appropriate incantation, but it produces an Access
 Violation:

     uint hash = typeid(char[]).getHash (myCharArray);

 - Kris
Jul 05 2004
prev sibling parent Stewart Gordon <smjg_1998 yahoo.com> writes:
Kris wrote:

 I thought this the appropriate incantation, but it produces an Access
 Violation:
 
     uint hash = typeid(char[]).getHash (myCharArray);
And I would've thought this the appropriate incantation: uint hash = myCharArray.toHash; Objects have the toHash property, why not arrays and atomic types? Stewart. -- My e-mail is valid but not my primary mailbox, aside from its being the unfortunate victim of intensive mail-bombing at the moment. Please keep replies on the 'group where everyone may benefit.
Jul 06 2004