casting int[] to bool[]

Jarrett Billingsley jarrett.billingsley at gmail.com
Thu Jan 29 07:59:52 PST 2009


On Thu, Jan 29, 2009 at 10:56 AM, Saaa <empty at needmail.com> wrote:
>
>> Ofine.  He could use to!(bool) then.
>
> erm...
>
> for(int i; i<data.length; i++)
> {
>  int[60] tempIn = to!(int[])(split(data[i][22..141].idup,`,`));
>
>  foreach(index, t; tempIn)
>  {
>  dataIn[i][index] = to!(bool)(t);
>  }
> }
>
> C:\D\dmd.2.023\dmd\src\phobos\std\conv.d(344):
> Error: cannot implicitly convert expression (value) of type int to bool
>
> C:\D\dmd.2.023\dmd\src\phobos\std\conv.d(206):
> template instance std.conv.toImpl!(int,bool) error instantiating
>
> C:\D\dmd.2.023\dmd\src\phobos\std\conv.d(34):
> template instance std.conv.to!(bool).to!(int) error instantiating

Well that's stupid.  Tango's to!() handles that case.  Phobos needs to catch up!


More information about the Digitalmars-d-learn mailing list