[Swift-user] how to change array index type

Tim Armstrong tim.g.armstrong at gmail.com
Mon Nov 24 21:26:33 CST 2014


Was fdf_proc_vn declared with [float] as the index type?

http://swift-lang.org/guides/trunk/userguide/userguide.html#_associative_arrays

- Tim

On Mon, Nov 24, 2014 at 8:19 PM, Ketan Maheshwari <ketan at mcs.anl.gov> wrote:

> Hi,
>
> I need to iterate over a float range between 0.1 and 1.0 with a step size
> of 0.1.
>
> My foreach loop looks like:
>
> foreach i in [0.1:1.0:0.1]
> {
> /* == generate fdfs for different voltages == */
> fdf_proc_vn[i]=gen_fdf(i,fdf_proc_v1);
> }
>
> I am getting the following error:
>
> Supplied array index type (float) does not match the declared index type
> (int)
>
> How to declare/define array such that it can accept float index type?
>
> Thanks,
> Ketan
>
>
> _______________________________________________
> Swift-user mailing list
> Swift-user at ci.uchicago.edu
> https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/swift-user/attachments/20141124/6d6de49c/attachment.html>


More information about the Swift-user mailing list