www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - UDAs and templates

--485b390f7a16612ad504d1247e2a
Content-Type: text/plain; charset=UTF-8

So I have this use case:

struct MarkedForMagic
{
    mixin template Lookup()
    {
        static this()
        {
            /* Look up all types, attributed with  MarkedForMagic and do
something with them. */
        }
    }
}

 MarkedForMagic class Magical1 { }
 MarkedForMagic class Magical2 { }

mixin MarkedForMagic,Lookup;

This question is: how do I register classes, which are inside templates?

 MarkedForMagic class Magical3(Type) { }

The symbol "Magical3" is not a class, but it contains potentially infinite
classes, every existing ones of which I need to know about.
How do I do this?

-- 
Bye,
Gor Gyolchanyan.

--485b390f7a16612ad504d1247e2a
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

So I have this use case:<div><br></div><div>struct MarkedForMagic</div><div=
{</div><div>=C2=A0 =C2=A0 mixin template Lookup()</div><div>=C2=A0 =C2=A0 =

=A0 =C2=A0 =C2=A0 {</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* = Look up all types, attributed with MarkedForMagic and do something with th= em. */</div> <div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 }</div><div>=C2=A0 =C2=A0 }<br>}</div><div=
<br></div><div> MarkedForMagic class Magical1=C2=A0{ }</div><div> MarkedFo=

kup;</div><div><div><br></div><div> This question is: how do I register classes, which are inside templates?</d= iv><div><br></div><div> MarkedForMagic class Magical3(Type) { }</div><div><= br></div><div>The symbol &quot;Magical3&quot; is not a class, but it contai= ns potentially infinite classes, every existing ones of which I need to kno= w about.</div> <div>How do I do this?</div><div><br></div>-- <br>Bye,<br>Gor Gyolchanyan.<= br> </div> --485b390f7a16612ad504d1247e2a--
Dec 18 2012