<div class="gmail_quote">On Fri, Aug 27, 2010 at 09:31, Jonathan M Davis <span dir="ltr"><<a href="mailto:jmdavisprog@gmail.com">jmdavisprog@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
However,<br>
as I understood it, you should be able to declare multiple enums within the same<br>
template and get this to work as long as you just have the one with the same<br>
name as the template. Am I wrong about that? Or is this a bug?<br>
<br></blockquote><div><br>I afraid you're wrong. Or, rather, the eponymous template trick (ETT) is activated only for one-member templates.<br>You can declare multiple enums, but not use the ETT at the same time.<br>
There was once some project to define 'private' enums, that wouldn't interfere with ETT, but it's not implemented now.<br><br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
It's certainly limiting if you can't declare multiple enums. What I'd like to be<br>
able to do is create multiple enums and then && them together to create isX,<br>
thereby nicely breaking up the condition into more manageable pieces. But it<br>
doesn't appear to work at the moment.<br></blockquote><div><br>To do that, use a helper template:<br><br>template isX(T)<br>{<br> alias isXImpl!(T).result isX; // one eponymous member<br>}<br><br>template isXImpl(T) // no eponymous member, all are accesible<br>
{<br> enum foo = isIntegral!T;<br> enum bar = isFloatingPoint!T;<br> enum baz = isArray!T;<br> enum result = foo && bar && !baz; // or alias Tuple!(foo,bar,baz) result; or whatever<br>}<br><br>
It's like rocket science: do a two-stage launch: :)<br><br>Philippe<br><br></div></div>