Using .length returns incorrect number of elements

QueenSvetlana svetlanalilyrosemond at gmail.com
Sun Aug 19 16:03:06 UTC 2018


On Sunday, 19 August 2018 at 15:53:25 UTC, Chris M. wrote:
> On Sunday, 19 August 2018 at 15:49:18 UTC, Chris M. wrote:
>> On Sunday, 19 August 2018 at 15:44:07 UTC, QueenSvetlana wrote:
>>> [...]
>>
>> auto appendNumber = appender(arrayofNumbers);
>>
>> This returns a separate object. You probably meant to put this 
>> for the last line
>>
>> writeln(appendNumber.length);
>
> Whoops
>
> writeln(appendNumber.data.length);
>
> https://run.dlang.io/is/4aNx1l

New to d programming here :D Bare with me.

The object that is returned by appendNumber.data is an array 
reflecting the elements I added using appendNumber correct? So I 
would have the call length on appendNumber.data instead of the 
original array?


More information about the Digitalmars-d-learn mailing list