Associative arrays with void values
Michel Fortin
michel.fortin at michelf.com
Mon Apr 13 03:04:45 PDT 2009
On 2009-04-13 01:53:41 -0400, bearophile <bearophileHUGS at lycos.com> said:
>> (Incidentally, I also think the natural set operations, like
>> intersection and mutual exclusion, are just as handy for maps as for sets.)
>
> It's less semantically clean to define certain set operations on AAs,
> because for example you have to decide what to do when keys are equal
> but their values are not.
You could pass an alias to a function that would perform the merge
between values. That way, there's not ambiguity.
> You can avoid such semantic troubles altogether performing set
> operations just only on the lazy view of the keys.
That'd require two passes: one for the keys, a second for getting the
values from both sides (merging the values). It's going to be less
efficient.
--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the Digitalmars-d
mailing list