Re: How about implementing more data structures (ie Map, Set)
| From: | Victor Berchet | Date: | Tue, 18 Dec 2012 18:53:48 +0000 |
| Subject: | Re: How about implementing more data structures (ie Map, Set) | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-64349@lists.php.net to get a copy of this message | ||
On 12/18/2012 07:46 PM, Anthony Ferrara wrote:
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...
Well let's say that object comparison methods (interface) is part of the details that I owe to this thread.