Suggestion: Operator `in` for slices
Dennis
dkorpel at gmail.com
Mon Dec 20 11:04:00 UTC 2021
On Sunday, 19 December 2021 at 18:31:46 UTC, Steven Schveighoffer
wrote:
> There's your answer -- make a custom type that allows `in` with
> an array-like structure.
For the record, I'm not arguing in favor of `in` for slices. I'm
just baffled that whenever this comes up, the first thing people
bring up is the 'time complexity' argument.
> That kind of expectation is useful from a generic point of view.
And this is my biggest problem with that argument: it's about
this mystical function that takes a generic data structure and
uses the `in` operator multiple times on it, which can now
suddenly be called on an array, ruining performance to the
surprise of the programmer.
What is this function? Does it exist in Phobos currently?
More information about the Digitalmars-d
mailing list