Re: [PATCH] SplObjectStorage::removeCommon and removeUncommon
| From: | Gustavo Lopes | Date: | Sun, 19 Dec 2010 15:16:38 +0000 |
| Subject: | Re: [PATCH] SplObjectStorage::removeCommon and removeUncommon | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-51088@lists.php.net to get a copy of this message | ||
On Sun, 19 Dec 2010 15:12:17 -0000, Hannes Magnússon <hannes.magnusson@gmail.com> wrote:
On Sun, Dec 19, 2010 at 16:05, Gustavo Lopes <glopes@nebm.ist.utl.pt> wrote:In the example, substituting removeCommon by removeAll has exactly the same result: <?php $a = (object) 'a'; $b = (object) 'b'; $c = (object) 'c'; $foo = new SplObjectStorage; $foo->attach($a); $foo->attach($b); $bar = new SplObjectStorage; $bar->attach($b); $bar->attach($c); $foo->removeAll($bar); var_dump($foo->contains($a)); var_dump($foo->contains($b)); gives bool(true) bool(false) Could you please explain the difference instead of telling me to RTFP? -- Gustavo LopesOn Sun, 19 Dec 2010 15:03:22 -0000, Hannes Magnússon <hannes.magnusson@gmail.com> wrote:Read the doc patch. The description says it all, but if you still wonder then look at the example.On Sun, Dec 19, 2010 at 15:49, Gustavo Lopes <glopes@nebm.ist.utl.pt> wrote:I did, and near the end it has:On Sun, 19 Dec 2010 05:33:56 -0000, Matthew Turland <tobias382@gmail.com> wrote:Is this just bikeshedding over the method names, or did you not bother reading the patches? (the doc patch even includes examples).Attached are source/test and manual patches for the addition of two methods to the SplObjectStorage class. These methods, removeCommon and removeUncommon, add support for the difference and intersection set operations, respectively.I'm sorry, I must be missing something because what exactly is the difference between removeCommon and removeAll?SPL_ME(SplObjectStorage, removeAll, arginfo_Object, 0) + SPL_ME(SplObjectStorage, removeCommon, arginfo_Object, 0)So there's already a removeAll.