Why can't we define re-assignable const reference variable?
Janice Caron
caron800 at googlemail.com
Sun Feb 17 11:42:37 PST 2008
On 17/02/2008, none <z at gg.com> wrote:
> So '_reference_ in D is similar to _pointer_ in C++', not reference in C++!
I disagree. I say a pointer is a pointer is a pointer, and that a
pointer in C++ is similar (nay, identical) to a pointer in D.
>
> Since 'in C++, const C* p; // non-const pointer, const data' is allowed, why
> cannot we have 'non-const reference, const data' in D?
Why not just substitute your C++ pointer with a D pointer?
If it's acceptable to use a pointer in C++, then use the same pointer in D.
More information about the Digitalmars-d
mailing list