Const sucks
Myron Alexander
someone at somewhere.com
Mon Sep 10 19:07:18 PDT 2007
Walter Bright wrote:
> o tail const of a struct would have to be done by making the struct a
> template:
>
> struct S(T) { T member; }
> S!(int) // tail mutable
> S!(const(int)) // tail const
>
Walter, how are references handled and can you create a tail const of a
reference?
Which of the following are correct syntax and how is the "constness"
defined:
class SomeClass {
some constructors
some variables
}
const SomeClass x = new SomeClass ();
SomeClass const(x) = new SomeClass ();
SomeClass x = const new SomeClass ();
SomeClass x = new const SomeClass ();
(anything I missed out?)
How can I create a tail const such that the reference is immutable but
the public instance variables and public methods are mutable?
What about arrays?
Regards,
Myron.
More information about the Digitalmars-d
mailing list