replaceFirst, findPieces, and takeExactly

bearophile bearophileHUGS at lycos.com
Sat Jan 22 14:16:07 PST 2011


Andrei:

> Back then people said that STL's find() is better than D's find()
> because the former returns 
> an iterator that can be combined with either the first iterator to get 
> the portion before the match, or with the last iterator to get the 
> portion starting at the match. D's find() only gives you the portion 
> after the match.

There's a HUGE problem here. This equivalence is sometimes true, but surely not always true:
"more powerful" != "better"


> That function allows you to pick a determined number of elements from a 
> range, assuming the range is never shorter than that. That sounds a bit 
> obscure, but plays a pivotal role in findParts() (which is the name I 
> settled on for the equivalent of Python's partition()):

"trisect" is way better than "findParts" :-) And it's a single word with no uppercase letters in the middle.

Bye,
bearophile


More information about the Digitalmars-d mailing list