Straight Forward Arrays

dhs dhs at email.com
Sun Oct 1 13:24:27 UTC 2023


On Sunday, 1 October 2023 at 13:05:12 UTC, Steven Schveighoffer 
wrote:
> On Sunday, 1 October 2023 at 09:01:53 UTC, dhs wrote:
>> Hi,
>>
>> Is there a straight forward Array type in D similar to C++'s 
>> vector class? Something along the lines of the tuple: (pointer 
>> to elements, length, capacity).
>>
>> [...]
>
> Std::vector uses value semantics. D does not have anything like 
> that. It could be done someone just has to do it.
>
> -Steve

Yes, and therein lies the problem: writing a dynamic array is not 
a very difficult task for an old developer like me. I looked at 
the D runtime and at the Phobos implementation for reference. The 
code is so extremely difficult to understand and uses so many 
advanced D features, that I doubt that I am up to the task. For 
me, the point of switching to D was to use a language that is 
simpler to read and maintain.


More information about the Digitalmars-d-learn mailing list