www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5361] New: Base template and template arguments

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 puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs 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: -------
Dec 21 2010