Alternatives to pointers?

Jerry hurricane at hereiam.com
Sat Sep 30 18:43:47 UTC 2017


On Saturday, 30 September 2017 at 04:15:52 UTC, bitwise wrote:
> 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;
> }

That is interesting, it would mean not using "[]" or "[..]", 
which would kind of suck.


More information about the Digitalmars-d mailing list