Hi!

Tell me please,in this code first and second static if,are these equivalent? with arg = 1, __traits(compiles,"check(arg);") = true, is(typeof(check(arg))) = false.

template ArgType(alias arg)
{
        void check(T)(ref T t) {};
//      static if(__traits(compiles,"check(arg);"))
        static if(is(typeof(check(arg))))
        {
                struct ArgType
                {
                        typeof(arg)* m_ptr;
                        this(ref typeof(arg) r)
                        {
                                m_ptr = &r;
                        }
                        @property ref typeof(arg) get()
                        {
                                return *m_ptr;
                        }
                        alias get this;
                }
        }
        else
                alias typeof(arg) ArgType;
}

Reply via email to