When interoperating with C, I often find myself being handed a pointer to an array. Chapel currently lets me treat this pointer as a 1D 0-indexed array. However, there are cases where I'd like to treat this pointer as a Chapel array (with eg. a multidimensional domain). What would the most idiomatic way to achieve this in Chapel?
I might have tried to do this by wrapping the C pointer in a class (with a domain) and defining this, and these (serial and parallel) methods so that one could index into and iterate over the class. In order to implement this, it would be useful to have a function that maps an index in a domain to a 0-indexed location. Is there such a built in function?