On Saturday, 28 June 2014 at 16:51:56 UTC, Sönke Ludwig wrote:
Am 28.06.2014 05:33, schrieb Peter Alexander:
On Saturday, 28 June 2014 at 02:46:25 UTC, safety0ff wrote:
On Saturday, 28 June 2014 at 02:02:28 UTC, Peter Alexander
int a;
const int b;
immutable int c;
foo(a);
foo(b);
foo(c);

These all call foo!int

Awesome, thanks!

... I just tried this and I'm wrong. The qualifier isn't stripped. Gah!
Three different versions!

I could have sworn D did this for primitive types. This makes me sad :-(

I *think* it does this if you define foo as "foo(T)(const(T) arg)", though.

Thanks, that works.
std.math doesn't do this for its templated functions, should it?

Is there an easy way to shared-strip primitive types?
Perhaps passing non-ref/non-pointer primitive data to const(T) should implicitly strip shared.
Reading of the shared data occurs at the call site.
Are there any use cases where passing on the shared-ness of a primitive type to non-ref const(T) is useful?

Reply via email to