appender!(dchar[]) put fail

Quentin Ladeveze via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jun 13 06:43:01 PDT 2015


On Saturday, 13 June 2015 at 13:32:19 UTC, kerdemdemir wrote:
>
> Thanks lot that is really good.
>
> One more question I am asking those kind of questions to 
> understand and not ask same stuff over and over, :

Don't worry, there is "learn" in "D.learn"

>
> auto totalStr = chain(stringB.replicate(bCount), 
> stringC.replicate(cCount));
> writeln(typeof(totalStr.array()).stringof);
> ---->dchar[]
>
> But
> auto totalStr = chain(stringB.repeat(bCount), 
> stringC.repeat(cCount));
> writeln(typeof(totalStr.array()).stringof);
> ---->dchar[][]
>
> It seems to me a little inconsistent. range.repeat and 
> array.replicate gives result in difference dimension.
>
> Is there any explanation or logic that I am missing which 
> results this behaviour?

Two functions doing the same thing would be the illogical thing, 
no ?


More information about the Digitalmars-d-learn mailing list