On 08/19/2012 02:39 AM, maarten van damme wrote:

> -is it normal that const ref is slower then ref?

Not normal but it can be arranged. :p

import std.stdio;
import core.thread;

struct S
{
    void foo()
    {}

    void foo() const
    {
        Thread.sleep(dur!("seconds")(3));
    }
}

void takes_ref(ref S s)
{
    s.foo();
}

void takes_const_ref(const ref S s)
{
    s.foo();
}

void main()
{
    auto s = S();
    takes_ref(s);
    takes_const_ref(s);
}

Ali

Reply via email to