dup method const or not?
Matthias Walter
xammy at xammy.homelinux.net
Sun Nov 27 15:06:36 PST 2011
On 2011-11-27 23:48, mta`chrono wrote:
> that's a real good question. it fails with the following error:
>
> Error: function std.bitmanip.BitArray.dup () is not callable using
> argument types () const
>
>
> here is a hack:
>
> ---
> import std.bitmanip;
> import core.stdc.string;
>
> void main()
> {
> const(BitArray) foo;
> BitArray bar;
>
> memcpy(&bar, &foo, BitArray.sizeof);
> }
Well, this hack doesn't even work - as it does a shallow copy only,
immediately setting bits of bar also changes bits of foo!
Matthias
More information about the Digitalmars-d-learn
mailing list