Why is ElementType!(char[]) == dchar?
rikki cattermole via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Jul 9 04:57:36 PDT 2016
On 09/07/2016 11:46 PM, Tofu Ninja wrote:
> On Saturday, 9 July 2016 at 11:35:24 UTC, Tofu Ninja wrote:
>> On Saturday, 9 July 2016 at 11:29:18 UTC, ketmar wrote:
>>> On Saturday, 9 July 2016 at 11:24:01 UTC, Tofu Ninja wrote:
>>>> Seems pretty silly to me...
>>>
>>> due to universally beloved autodecoding.
>>
>> Hmmm... I dont really know the history of autodecoding, why was that
>> supposed to be a good idea?
>
> Hmm, well I fixed my problem that originally prompted me to ask this by
> using ubyte instead of char. Still kinda curious on the whole
> autodecoding thing and why it's even a thing.
In this case, its not aut odecoding.
ElementType is using std.range : front for array's since they do not
provide a front method.
That implementation is weird in that it returns a dchar instead of the
raw type. Which is decoding, but it is not auto decoding. Auto decoding
involves the foreach statement. So std.traits : ForeachType if that
returned dchar then yes that would be because of auto decoding.
More information about the Digitalmars-d-learn
mailing list