ADT
aaron-thesis
arm-eh
ast-experimental
cleanup-dtors
ctor
deferred_resn
demangler
enum
forall-pointer-decay
gc_noraii
jacob/cs343-translation
jenkins-sandbox
memory
new-ast
new-ast-unique-expr
new-env
no_list
persistent-indexer
pthread-emulation
qualifiedEnum
resolv-new
string
with_gc
|
Last change
on this file since c8ffe20b was 134b86a, checked in by Peter A. Buhr <pabuhr@…>, 11 years ago |
|
add compiler flag to driver, update examples, fix unnamed bit fields
|
-
Property mode
set to
100644
|
|
File size:
764 bytes
|
| Line | |
|---|
| 1 | // "cfa -c -o array.o array.c"
|
|---|
| 2 | // "cfa -CFA array.c > array_out.c"
|
|---|
| 3 | // "gcc32 array_out.c ../LibCfa/libcfa.a"
|
|---|
| 4 |
|
|---|
| 5 | #include "array.h"
|
|---|
| 6 |
|
|---|
| 7 | /// forall( type array_type, elt_type | bounded_array( array_type, elt_type ) )
|
|---|
| 8 | /// [ array_iterator begin, array_iterator end ]
|
|---|
| 9 | /// get_iterators( array_type array )
|
|---|
| 10 | /// {
|
|---|
| 11 | /// begin = 0;
|
|---|
| 12 | /// end = last( array );
|
|---|
| 13 | /// }
|
|---|
| 14 |
|
|---|
| 15 | // The first element is always at index 0.
|
|---|
| 16 | forall( type array_type, type elt_type | bounded_array( array_type, elt_type ) )
|
|---|
| 17 | elt_type * begin( array_type array ) {
|
|---|
| 18 | return &array[ 0 ];
|
|---|
| 19 | }
|
|---|
| 20 |
|
|---|
| 21 | // The end iterator should point one past the last element.
|
|---|
| 22 | forall( type array_type, type elt_type | bounded_array( array_type, elt_type ) )
|
|---|
| 23 | elt_type * end( array_type array ) {
|
|---|
| 24 | return &array[ last( array ) ] + 1;
|
|---|
| 25 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.