Testing for template argument being result of takeExactly
monarch_dodra
monarchdodra at gmail.com
Sun Sep 23 12:02:17 PDT 2012
On Saturday, 22 September 2012 at 23:53:28 UTC, Jonathan M Davis
wrote:
> I'm trying to test...
> [SNIP]
> - Jonathan M Davis
I *kind of* see what you are doing with U, V, W, but what's wrong
with just doing:
----
import std.range;
template Hello(R)
if(is(typeof(R == typeof(takeExactly(R, 1)))))
{
alias R Hello;
}
struct S;
void main( ) {
Hello!(int[]) a; //OK
Hello!S b; //FAIL
}
----
?
It seems to work for me..., but I'm not 100% sure there isn't
something illegal/unsafe in there.
More information about the Digitalmars-d-learn
mailing list