Alternatives to pointers?

bitwise bitwise.pvt at gmail.com
Sat Sep 30 04:15:52 UTC 2017


On Friday, 29 September 2017 at 01:51:36 UTC, Jerry wrote:
> [...]

Maybe this?

ref auto at(T : U[], U)(T arr, size_t index) {
     return arr[index];
}

int main(string[] argv)
{
     int* a = new int(1);
     int[] b = [1];
     int[1] c = [1];
     a.at(0); // won't compile
     b.at(0);
     c.at(0);
     reutnr 0;
}


More information about the Digitalmars-d mailing list