[Issue 8420] isExpression and templates should capture all template parameters when using variadic TemplateParameter

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jul 23 08:43:56 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8420



--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> 2012-07-23 08:43:53 PDT ---
(In reply to comment #0)
> tl;dr: inside an IsExpression, T... should match a whole TemplateParameterList,
> not just a TemplateTupleParameter.

I think, now almost of cases have been covered in 2.060head.
What case isn't covered?

----
template TemplateInfo( T ) {
    static if ( is( T t == U!V, alias U, V... ) ) {
        alias U Template;
        alias V Arguments;
    }
}

struct Rebindable(T) {}
struct Tuple(T...) {}
struct Map(alias X, T...) {}
struct Pack(int n, T...) {}

alias TemplateInfo!( Rebindable!int ) T;
pragma(msg, T.Template, " -> ", T.Arguments);

alias TemplateInfo!( Tuple!(int) ) U;
pragma(msg, U.Template, " -> ", U.Arguments);

alias TemplateInfo!( Tuple!(int, int) ) V;
pragma(msg, V.Template, " -> ", V.Arguments);

alias TemplateInfo!( Tuple!(int, 10) ) W;
pragma(msg, W.Template, " -> ", W.Arguments);

alias TemplateInfo!( Map!(Map, int) ) X;
pragma(msg, X.Template, " -> ", X.Arguments);

alias TemplateInfo!( Pack!(10, "str") ) Y;
pragma(msg, Y.Template, " -> ", Y.Arguments);

alias TemplateInfo!( Pack!(10, int) ) Z;
pragma(msg, Z.Template, " -> ", Z.Arguments);

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list