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:
@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user