Old problem with performance

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Fri Feb 13 08:02:32 PST 2009


Denis Koroskin wrote:
> On Fri, 13 Feb 2009 17:24:54 +0300, Andrei Alexandrescu 
> <SeeWebsiteForEmail at erdani.org> wrote:
> 
>> Rainer Deyke wrote:
>>> Andrei Alexandrescu wrote:
>>>> C++ ctors won't do the right thing if you use pointers, which is the
>>>> moral equivalent of using T[] inside MathematicalVector. If you 
>>>> refer to
>>>> std::vector instead, then that's a carefully-defined type that does 
>>>> have
>>>> the right copy constructor defined.
>>>  So where's the D equivalent of std::vector?  Phobos has nothing.
>>
>> It will.
>>
>>> I was under the impression that native arrays were intended to be used
>>> directly in D, something I rarely do in C++.  Certainly neither of the
>>> standard libraries has any hesitation about passing unadorned dynamic
>>> arrays around.
>>
>> Phobos2 plans to consistently consider T[] a range, not a full-fledged 
>> array. A range corresponds to a pair of iterators in STL.
>>
>>
>> Andrei
> 
> Will T[] get front, back, empty properties, and popFront(), popBack() 
> methods?

Yes, not as methods, but as free functions.

> Perhaps, its the time T[] internal structure is changed!
> For example, ptr+size replaced by two pointers, some additional fields 
> added etc..

I agree. Walter said let's get ranges going and then we can look into 
optimizing the structure. Ranges seem to work really well so the 
structural change will follow soon.


Andrei



More information about the Digitalmars-d mailing list