On 2/22/15, 1:19 PM, "John MacFrenz" <[email protected]> wrote:
>I was thinking of the latter approach. Also a generic ring buffer
>implementation would be useful in cases like this. I almost started
>writing one, storing in array N elements of type T. However, I couldn't
>figure a way to write a method getCurrent(), which would return current
>element in buffer, so that it would always return a reference. Or any
>other clever way so user could always modify the current element in ring
>buffer.
Does the ref return intent work for you?
As in this example program (which I've verified compiles and runs):
var A = [1,2,3,4,5];
proc element(i:int) ref
{
return A[i];
}
writeln(A);
element(1) = 10;
writeln(A);
Or is there some reason that the ref return intent does not
solve the problem?
Best,
-michael
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users