Testing for template argument being result of takeExactly

Jonathan M Davis jmdavisProg at gmx.com
Sun Sep 23 14:54:01 PDT 2012


On Sunday, September 23, 2012 14:47:27 Timon Gehr wrote:
> template Hello(R) if(is(typeof(R._input.takeExactly(2)) == R)){
>      alias R Hello;
> }

Thanks. That does the trick quite cleanly, though you'd think that it would be 
possible to test whether a template argument is the result of takeExactly 
without caring or knowing about the guts of takeExactly. So, this isn't a 
general purpose solution at all, when I think that there should be one. Still, 
I don't need a general purpose one for what I'm doing, so this should work 
just fine.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list