Any word on the return-type const syntax?
Janice Caron
caron800 at googlemail.com
Sun Dec 9 00:23:05 PST 2007
On 12/9/07, Janice Caron <caron800 at googlemail.com> wrote:
> > transfer_const.d(7): Error: cannot implicitly convert expression
> > (cast(int*)(this.a)) of type int* to invariant(int)*
>
> Yep, sorry. It should be
No, sorry - I figured out the problem. Invariant classes and invariant
member functions make no sense. This was discussed in another thread
somewhere, and Walter agreed. So in fact, you only have to consider
the const and non-const instantiations. You can forget the invariant
one. So, in fact, you only need
class MyArray(T)
{
T[] a;
T* ptr() { return a.ptr; }
const(T)* ptr() const { return a.ptr; }
}
More information about the Digitalmars-d
mailing list