mirror of
https://github.com/golang/go
synced 2024-11-17 05:04:54 -07:00
allow pointers as keys in maps, treating them the same as ints - ptr eq not value equality
R=ken,gri OCL=13879 CL=13879
This commit is contained in:
parent
033682deec
commit
5adbacb8e7
@ -40,7 +40,7 @@ sys·newmap(uint32 keysize, uint32 valsize,
|
||||
{
|
||||
Hmap *m;
|
||||
|
||||
if(keyalg >= 2 ||
|
||||
if(keyalg >= 3 ||
|
||||
valalg >= 3) {
|
||||
prints("0<=");
|
||||
sys·printint(keyalg);
|
||||
|
@ -777,7 +777,8 @@ pointercopy(uint32 s, void **a, void **b)
|
||||
Alg
|
||||
algarray[3] =
|
||||
{
|
||||
{ &memhash, &memequal, &memprint, &memcopy },
|
||||
{ &stringhash, &stringequal, &stringprint, &stringcopy },
|
||||
{ &pointerhash, &pointerequal, &pointerprint, &pointercopy },
|
||||
{ &memhash, &memequal, &memprint, &memcopy }, // 0
|
||||
{ &stringhash, &stringequal, &stringprint, &stringcopy }, // 1
|
||||
// { &pointerhash, &pointerequal, &pointerprint, &pointercopy }, // 2
|
||||
{ &memhash, &memequal, &memprint, &memcopy }, // 2 - treat pointers as ints
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user