Issue with const
Jacob Carlborg
doob at me.com
Mon Apr 9 10:51:17 PDT 2012
On 2012-04-09 17:30, Steven Schveighoffer wrote:
> // untested
> inout(Foo) clone() inout {
> return new inout(Foo)(data);
> }
>
> Note, you can't post-assign data, since inout is effectively const
> inside an inout function.
>
> -Steve
Ok, that works. But then I want to modify the clone:
void bar (const Foo foo)
{
auto c = foo.clone();
c.data = ...
}
But now "c" is const. I don't want "c" to be const, I just want "foo" to
be const.
--
/Jacob Carlborg
More information about the Digitalmars-d-learn
mailing list