Bartosz Milewski seems to like D more than C++ now :)

Szymon Gatner noemail at gmail.com
Fri Sep 20 03:55:28 PDT 2013


On Friday, 20 September 2013 at 10:47:52 UTC, Dmitry Olshansky 
wrote:
> 20-Sep-2013 14:00, Jacob Carlborg пишет:
>> On 2013-09-20 11:37, Szymon Gatner wrote:
>>
>>> If only std algorithms took containers (by that I mean things 
>>> that
>>> container for accepts too) as arguments (and not 
>>> iterators)... even in
>>> the form of new functions like foreach_all, transform_all etc.
>>
>> Can't a container be a range as well?
>>
>
> For Christ sake no, no and no. For starters range skips/drops 
> elements when iterating, and thusly iteration has its own state 
> that is useless for a container otherwise.

That would be a filtering range which adds additional logic that 
costs exactly the same as an if() statement inside a for loop 
when filtering on condition manually.

>
> TL;DR: Suboptimal, unnatural and error prone are keywords.

Why would it be suboptimal?


More information about the Digitalmars-d mailing list