Re: How about implementing more data structures (ie Map, Set)
| From: | Anthony Ferrara | Date: | Tue, 18 Dec 2012 18:46:32 +0000 |
| Subject: | Re: How about implementing more data structures (ie Map, Set) | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-64348@lists.php.net to get a copy of this message | ||
Victor,
If you give a closer look to my example, you will notice a difference:
> $map[$setA] and $map[$setB] point to the same storage which I think is not
> possible with SPLObjectStorage.
>
Well, how could you do that? Without implementing object comparison methods
at least (which is outside the scope of this discussion)? I could see a
type-specific map which knows how to compare the classes, but in general
you'd need to defer comparison to the objects themselves (so $obj1 == $obj2
would fire $obj1->compareTo($obj2) === 0)...
Unless I've got something confused...