On Sunday, 1 October 2023 at 13:24:27 UTC, dhs wrote:
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.
D can be very readable and maintainable, but since all the
advanced features exist, we are tempted to use them, which can
cause otherwise normal code to become a bit obfuscated.