Comment #0 by bearophile_hugs — 2012-05-30T05:15:59Z
I think there's no need to refuse this code:
import std.bigint: BigInt;
void main() {
auto b1 = BigInt(1);
auto b2 = BigInt(b1);
}
DMD 2.060alpha gives:
test.d(4): Error: template std.bigint.BigInt.__ctor does not match any function template declaration
...\dmd2\src\phobos\std\bigint.d(82): Error: template std.bigint.BigInt.__ctor cannot deduce template function from argument types !()(BigInt)
Currently BigInt contains immutable digits, so that operation is O(1).
GMP supports mutable numbers too for higher efficiency for certain operations, if BigInt will do the same, then BigInt(BigInt(1)) will create a copy of the digits.