std.bigint.BigInt and const modifier

Ruslan Mullakhmetov public at mullakh.com
Sun Feb 16 12:17:53 PST 2014



BigInt is a struct == ValueType, suppose i can assign 
const(BigInt) to BigInt
const(BigInt)/const(BigInt) do not compile.

Is it a bug or design considerations?

test.d
----
import std.stdio;
import std.bigint;

void foo(BigInt b)
{
	std.stdio.writefln("foo(%s)", b);
}

void main()
{
	const BigInt b = BigInt("445216415446");

	auto b1 = b / b;

	foo(b);
}
----

$ dmd test.d
/tmp/test.d(14): Error: 'b' is not of arithmetic type, it is a 
const(BigInt)
/tmp/test.d(14): Error: 'b' is not of arithmetic type, it is a 
const(BigInt)
/tmp/test.d(16): Error: function test.foo (BigInt b) is not 
callable using argument types (const(BigInt))


More information about the Digitalmars-d-learn mailing list