A small const problem
Peter Alexander
peter.alexander.au at gmail.com
Fri Mar 16 06:33:25 PDT 2012
On Friday, 16 March 2012 at 01:43:41 UTC, bearophile wrote:
> So in a way here I am looking for a const that makes the struct
> fields not mutable, but allows me to rebind the whole structs.
But that would make the fields mutable:
struct Foo
{
Foo(int _a, int _b, int _c) { a = _a; b = _b; c = _c; }
int a;
int b;
your_const(int) c;
}
Foo f = Foo(1, 2, 3);
f.c = 4; // illegal - good.
but...
f = Foo(f.a, f.b, 4); // ok? But it's the same thing.
More information about the Digitalmars-d
mailing list