The problem with const (and a solution)

Sönke Ludwig ludwig at informatik_dot_uni-luebeck.de
Fri Dec 7 09:54:14 PST 2007


Steven Schveighoffer schrieb:
>>
>> // struct references
>> S a = S(1);
>> S& b = a;
> 
> This would not compile, a is a value type, b is a pointer type, you need:
> S&b = &a;

Hm, ok, so S& is the same as S* then?

The class example should just show that it might be unexpected for a C++ 
programmer that the assert fails. But then again, D's classes already behave 
differently anyway.



More information about the Digitalmars-d mailing list