March 30, 2005
I have a global static array called

	int[6] UTtime;

and a function that returns a dynamic array (also with 6 elements):

	int[] dt = convert_Dtime_to_Digits( myTimeUT );

but:

	UTtime = convert_Dtime_to_Digits( myTimeUT );

will not compile, since there is a conflict between the static and dynamic arrays, even though they have the same size. That is to be expected.

So is the below:

	foreach( int i, int datetime; UTtime )
		UTtime[i] = datetime;

the only way to copy the data? Or is there some other D shortcut to copy the data between arrays?

AEon
March 30, 2005
On Wed, 30 Mar 2005 04:32:14 +0200, AEon wrote:

> I have a global static array called
> 
> 	int[6] UTtime;
> 
> and a function that returns a dynamic array (also with 6 elements):
> 
> 	int[] dt = convert_Dtime_to_Digits( myTimeUT );
> 
> but:
> 
> 	UTtime = convert_Dtime_to_Digits( myTimeUT );
> 
> will not compile, since there is a conflict between the static and dynamic arrays, even though they have the same size. That is to be expected.
> 
> So is the below:
> 
> 	foreach( int i, int datetime; UTtime )
> 		UTtime[i] = datetime;
> 
> the only way to copy the data? Or is there some other D shortcut to copy the data between arrays?

The syntax to use in this case is ...

    UTtime[] = convert_Dtime_to_Digits( myTimeUT );

But the function *must* return exactly the same length as the fixed array length.

-- 
Derek
Melbourne, Australia
30/03/2005 12:43:10 PM