Inability to dup/~ for const arrays of class objects
Michel Fortin
michel.fortin at michelf.ca
Tue May 28 20:22:08 PDT 2013
On 2013-05-29 03:09:56 +0000, Michel Fortin <michel.fortin at michelf.ca> said:
> It's a different problem that'll require a different solution, and if
> it requires special syntax it should be at the struct declaration, not
> at the type declaration. Something like that:
>
> struct MyRange(inheritedconstness(T)) {
> T[] bla;
> this(const MyRange r) { bla = r.bla; }
> }
>
> immutable(MyRange!T) t; // real type becomes immutable(MyRange!(immutable(T))
> MyRange!(immutable(T)) u = t; // calls above constructor
>
> Wouldn't this be enough?
Ah, well no it won't work if you want to copy or reinterpret it as a
MyRange!(const(T)) or const(MyRange!T).
--
Michel Fortin
michel.fortin at michelf.ca
http://michelf.ca/
More information about the Digitalmars-d
mailing list