std.algorithm.remove from array of custom classes?
Andrea Fontana via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Dec 9 05:34:24 PST 2015
On Wednesday, 9 December 2015 at 13:13:36 UTC, BBaz wrote:
> 3) opEquals can be 'const' because the method doesn't mutate
> the state of the object
> 4) your cast wasn't safe
>
>
> http://dlang.org/phobos/std_algorithm_mutation.html#.remove
Maybe something like this works better:
...
override bool opEquals(T)(T obj) const
if (is(T : A))
{
return (s == o.s) && (u == o.u);
}
...
More information about the Digitalmars-d-learn
mailing list