Fix container ctors and opAssign ref parameters

Container constructors and opAssign should accept any ref container and
not only const, otherwise the source container will be copied because
the constructor/opAssign without ref would be a better match.
This commit is contained in:
2017-05-01 09:48:12 +02:00
parent 65c3ca14ec
commit f2aac680c5
3 changed files with 16 additions and 18 deletions

View File

@ -245,16 +245,10 @@ struct Integer
ref Integer opAssign(T)(T value) nothrow @safe @nogc
if (is(T == Integer))
{
if (this.allocator is value.allocator)
{
swap(this.rep, value.rep);
swap(this.sign, value.sign);
swap(this.size, value.size);
}
else
{
this = value;
}
swap(this.rep, value.rep);
swap(this.sign, value.sign);
swap(this.size, value.size);
swap(this.allocator_, value.allocator_);
return this;
}