On Thursday, 14 June 2012 at 17:44:11 UTC, Jonathan M Davis wrote:
I was just thinking that maybe we should make a generic function for
this and add it to Phobos. Something like

auto makePtr(T, U)(U value) if(is(U : T)) {}
auto makePtr(T, Args...)(Args args) {}

where the first one works with primitive types and the second one works with
structs. Then you could do

auto f = makePtr!(immutable float)(2.1);

I think that I'll have to see about throwing together something like that
tonight and create a pull request.

- Jonathan M Davis
Am I right that [2.0].ptr (instead of 2.0 could be a struct literal) doesn't involve copying, while such function would?

Reply via email to