Const Ideas

Bill Baxter dnewsgroup at billbaxter.com
Mon Dec 3 02:00:40 PST 2007


Walter Bright wrote:
> Janice Caron wrote:
>> const(X) must mean the same thing as const X, for all X. Unless you
>> have that, there will always be complaints.
> 
>...[explanation snipped]
> 
> The natural question then, is why have:
> 
>     const(int) x;
> 
> at all? The reason is when one is deconstructing types using templates, 
> and then reconstructing them, the const-correctness of what is being 
> referred to must be carried along, else the const-correctness is lost.

Great explanation.

Any ETA on an updated const article?
I think this one is out of date since it still talks about final.
http://www.digitalmars.com/d/const.html

--bb



More information about the Digitalmars-d mailing list