On 2013-02-05, 23:46, Max Samukha wrote:

On Tuesday, 5 February 2013 at 18:33:36 UTC, Andrei Alexandrescu wrote:


Walter and I reviewed the discussion and had a long talk. We are very seriously considering banning the use of & against a ref result from a function

Please, no.

ref T foo();

extern(C) void bar(T*);

bar(&foo()); // how?


    @system T* addressOf(T)(ref T obj)
    {
        static T* id(T* p) { return p; }
        auto idr = cast(T* function(ref T)) id;
        return idr(obj);
    }

    bar(addressOf(foo()); // Like this

It's right there in his post.

--
Simen

Reply via email to