[Issue 5361] New: Base template and template arguments

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Dec 21 00:25:18 PST 2010


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

           Summary: Base template and template arguments
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2010-12-21 00:23:22 PST ---
Sometimes while I use templates, given a type I want to know what's the
template it comes from. So in code like this:


struct Foo(T) {}
struct Bar(T) {}
void main() {
    alias Foo!int Spam;
}


I want to know if Spam is an instantiation of Foo or Bar, and sometimes I'd
even like to know the typetuple of arguments that has created Spam (here is
(int,)).

Currently there are some ways to solve this problem (and there's a module in
dsource to find the typetuple of the instantiation template arguments), but I'd
like a simple to use, robust, safe, and standard way in Phobos or in __traits,
because I think this is a common enough need.

-- 
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