is(ElementType!(char[2]) == dchar - why?

H. S. Teoh hsteoh at quickfur.ath.cx
Tue Dec 11 18:10:48 UTC 2018


On Wed, Dec 12, 2018 at 06:56:46AM +1300, rikki cattermole via Digitalmars-d-learn wrote:
> On 12/12/2018 6:51 AM, Denis Feklushkin wrote:
> > import std.stdio;
> > import std.range.primitives;
> > 
> > void main()
> > {
> >      writeln(
> >          typeid(ElementType!(char[2]))
> >      );
> > 
> >      static assert(is(ElementType!(char[2]) == dchar)); // why?
> > }
> > 
> > ?
> > 
> > https://run.dlang.io/is/Q74yHm
> 
> Because docs: https://dlang.org/phobos/std_range_primitives.html#ElementType
> 
> What you probably want is:
> https://dlang.org/phobos/std_traits.html#ForeachType

Autodecoding raises its ugly head again. :-/


T

-- 
It is the quality rather than the quantity that matters. -- Lucius Annaeus Seneca


More information about the Digitalmars-d-learn mailing list