next up previous contents
Next: Array Promotions Up: Miscellany Previous: Miscellany

Sequential arrays

We saw in section 2.11 how a sequential array can be implemented in terms of a general Adlib array, by using collapsed ranges. It is convenient, however, to provide a separate family of lightweight, sequential array classes. They are parametrised simply by integer extents, and elements are accessed through integer subscripts

  SArray2<float> a(10, 10) ;
  SArray1<float> b(20) ;

  a(5, 5) = b(10) ;
The only advantage over ordinary C++ arrays (which, of course, remain available to the Adlib programmer) is that Adlib sequential arrays are bundled with a hidden shape parameters, accessible through inquiry functions. These allow construction of shape-generic library functions.



Bryan Carpenter
Fri Feb 23 15:40:28 EST 1996