Re:Go maps in action
by cmccabe on Saturday February 09, 2013 @02:44AM
(#5192033)
You can use interfaces types as the keys to a map. So you could easily have a map with both 3-tuples and 4-tuples as keys, just by having one struct with 3 elements and one with 4 implement the same interface and using that as the key. Of course, if you want a truly arbitrary length key, you'll probably have to use the convert-to-string trick.
[ Parent
| on HN ]
There are no comments on this comment yet.