Will D 2.x have refrences
Jari-Matti Mäkelä
jmjmak at utu.fi.invalid
Thu Oct 11 05:44:56 PDT 2007
BLS wrote:
> I mean something comparable to :
> //C++
> int value = 100;
> int & rIntRef = value;
> if (rIntRef == 100)
> // be ashured my val is 100
> rIntref = 101
> if (&rIntref == &value)
> // Yes we have the same address
>
> (not parameter passing)
> Bjoern
void main() {
int value = 100;
alias value rIntRef;
if (rIntRef == 100)
rIntRef = 101;
assert(value == 101);
assert(&value == &rIntRef);
}
Alias parameters also work in functions wrapped inside templates.
More information about the Digitalmars-d
mailing list