const debacle

Sean Kelly sean at invisibleduck.org
Fri Mar 21 11:09:18 PDT 2008


== Quote from Steven Schveighoffer (schveiguy at yahoo.com)'s article
> "BCS" wrote
> >
> > IIRC Walter has something planed for this. Something to do with a "return"
> > const type. It would do just that; "the function's return type has the
> > same constness as one of it's arguments."
> >
> > In short: Not yet.
> I remember that idea.  I'm concerned however that in this mode, the compiler
> will not check the function itself for const-correctness (i.e. ensure it
> doesn't modify the input) because the argument will not be const.  See my
> reply to Walter for my example.  I want a way to specify "the function's
> return type has the same constness as one of it's arguments, and it promises
> not to modify that argument, and the compiler made sure of that."

Oops, I'd forgotten about this while writing my post.  In short, I don't think there's any way to do this
automatically.  You'd likely either have to supply the type manually or resort to some sort of proxy
function to do this for you.


Sean



More information about the Digitalmars-d mailing list