<div class="gmail_quote">On Mon, Apr 19, 2010 at 07:43, Justin Spahr-Summers <span dir="ltr"><<a href="mailto:Justin.SpahrSummers@gmail.com">Justin.SpahrSummers@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;">
<br>
Yes, sorry. That's what I was trying to do originally, but I couldn't<br>
quite spit it out. Indeed, templating the actual arguments is a horrible<br>
idea.<br>
</blockquote></div><br>Sorry to comment on it, then. I'm discovering all this by myself, so I don't know if what I generally post is a well-known established practice or a nice trick few people use... (or a brillant idea only a genius could utter, but hey...)<br>
<br>Just to complete it, and as it's on my mind: I found one case, yesterday, when you have to pass the args as CT args: filtering on a tuple. Strange idea maybe, but fun to code.<br>That is:<br><br>auto t = tuple(1, 'a', "abc", 3.14159);<br>
auto f = filterTuple!(polymorphicPredicate)(t); // should return a smaller tuple, with 1, 'a',... filtered according to polymPredicate<br><br>This does not work, because I have to determine the return type of filterTuple as CT, obviously. And this return type in turn depends on the _values_ stored inside the tuple. At CT, I can check the types, but not the values, unless I use them as CT args:<br>
auto f = filterTuple!(polymorphicPredicate, t)();<br><br>But then, I'm limited by what you can use as a template parameter (not all possible D types are allowed, I think). Maybe as an alias...<br><br>I'll stop, now, before derailing the thread. I'm trying to use tuples as a sort-of cousin of ranges, by mapping, chaining or truncating them...<br>
<br>Philippe<br><br>