Rationale for no opIndex, length in std.algorithm.map?
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Wed May 13 06:03:22 PDT 2009
dsimcha wrote:
> What is the rationale for lack of opIndex and length in map? opIndex might be
> a bad idea if the function being mapped is expensive, but it's not so bad if
> the function is cheap. Length just seems like a no-brainer to me if the
> underlying range has a length. There are several places in various code I've
> written where I need to copy an arbitrary range, or some transform of it, to
> an array, and this obviously can be done more efficiently when the length is
> known in advance. Were these just oversights, and should an enhancement
> request be filed, or is there a good reason for excluding them?
It's an oversight. map should offer opIndex and length iff the mapped
range offers them.
Could you please bugzilla that?
Andrei
P.S. I appreciate the great work you're doing. Good going!
More information about the Digitalmars-d
mailing list