The tailconst problem (and suggestions for solution)

Janice Caron caron800 at googlemail.com
Fri Dec 7 04:31:22 PST 2007


On Dec 7, 2007 11:00 AM, Walter Bright <newshound1 at digitalmars.com> wrote:
> That doesn't work because of the need to have a consistent system for
> use with generic code.

I think I got misunderstood. But no matter - it's unimportant. It just
goes to show how hard it is to have a conversation about this stuff at
all! :-)


> If it can be done with a template, then I'd prefer the template solution

I believe it can be done with a template, yes.

However, that template needs to be written by someone who really
understands what goes on under the hood, because (if it works like I
think it will have to work) that template is going to need to do
something which the manual says is undefined: it will have to cast
away const (in at least one place). That's not a problem in a
standard-library-provided template, of course. It's probably better
done there than in user code.

That said, Andrei is much smarter than I, so maybe he can do it
without even needed that cast.


> I'd like to accumulate more experience with const to see if there is a
> pressing need to solve this problem, otherwise we risk throwing in
> complex solutions for non-issues.

Makes total sense to me. I agree completely.
Thanks



More information about the Digitalmars-d mailing list