Copying copy?

bearophile bearophileHUGS at lycos.com
Fri Jul 26 07:46:21 PDT 2013


monarch_dodra:

> I reacted to your bug entry.

Thank you very much for your comments. I am wrong all the time... 
I have written a small answer.


> However, copy could be improved with the knowledge that a dchar 
> can be streamed into a series of chars (EG, the way an 
> appender!(char[]) can handle taking a dchar), and improved to 
> handle cases it didn't handle before.

Is your improvement enough to solve this problem of mine?

import std.range, std.algorithm;
void main() {
     char[5] arr;
     auto r = 5.iota.map!(i => cast(char)(i + 'a'));
     static assert(is(typeof(r.front) == char)); // OK
     r.copy(arr[]); // error
}

Is that Issue 10718 to be closed, or do you suggest to turn it 
into an enhancement request for your proposed improvements of 
"copy" and "array"?

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list