`ref T` should be a type!!
Rubn
where at is.this
Mon Apr 1 00:35:01 UTC 2019
On Monday, 1 April 2019 at 00:18:40 UTC, Walter Bright wrote:
> On 3/29/2019 12:55 PM, Rubn wrote:
>> You can't have reference variables in D, and I doubt walter
>> will allow them. It doesn't make much sense to have a type
>> that allows ref if you can't declare a variable with it.
>
> You can't declare a pointer to a ref in C++, either. It's not a
> real type.
It's a type with a restriction, you can literally use it
everywhere else you can use a type. A reference is just a pointer
with a dress on, having a naked pointer go with a dressed pointer
doesn't make much sense.
Taking the address of a reference returns a pointer to the object
the reference points to, not a pointer to the reference. It's
impossible to get the address of the actual reference (* without
some hack).
But sure it's not a type because you can't have a pointer to it.
std::is_same_v<int, int&>;
More information about the Digitalmars-d
mailing list